fork download
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4. char Price[100];
  5. double newPrice;
  6.  
  7. int main()
  8. {
  9. myval();
  10. return 0;
  11. }
  12.  
  13. myval()
  14. {
  15. printf("\nPlease enter the price:");
  16. fgets(Price, 100, stdin);
  17.  
  18. newPrice = atof(Price);
  19. printf("\nPrice of item is %f", newPrice);
  20. }
Success #stdin #stdout 0s 2252KB
stdin
12.3
stdout
Please enter the price:
Price of item is 12.300000