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