fork(1) download
  1.  
  2. #include <stdio.h>
  3. int main ()
  4. {
  5. // cents and coins
  6. float euro_1cent;
  7. float euro_2cent;
  8. float euro_5cent;
  9. float euro_10cent;
  10. float euro_20cent;
  11. float euro_50cent;
  12. float euro_1coin;
  13. float euro_2coin;
  14.  
  15. // ask how many cents or coins
  16. printf("how many 1 euro cent is in the jar:\n");
  17. scanf("%f", &euro_1cent);
  18.  
  19. printf("how many 2 euro cents is in the jar:\n");
  20. scanf("%f", &euro_2cent);
  21.  
  22. printf("how many 5 euro cents is in the jar:\n");
  23. scanf("%f", &euro_5cent);
  24.  
  25. printf("how many 10 euro cents is in the jar:\n");
  26. scanf("%f", &euro_10cent);
  27.  
  28. printf("how many 20 euro cents is in the jar:\n");
  29. scanf("%f", &euro_20cent);
  30.  
  31. printf("how may 50 euro cents is in the jar:\n");
  32. scanf("%f", &euro_50cent);
  33.  
  34. printf("how many 1 euro coins is in the jar:\n");
  35. scanf("%f", &euro_1coin);
  36.  
  37. printf("how many 2 euro coins is in the jar:\n");
  38. scanf("%f", &euro_2coin);
  39.  
  40. // adding all the cents and coins together
  41. float jar =
  42. (euro_1cent * 0.01) +
  43. (euro_2cent * 0.02) +
  44. (euro_5cent * 0.05) +
  45. (euro_10cent * 0.1) +
  46. (euro_20cent * 0.2) +
  47. (euro_50cent * 0.5) +
  48. (euro_1coin * 1.0) +
  49. (euro_2coin * 2.0);
  50.  
  51. printf ("\ninside the jar is:%f euros",jar);
  52.  
  53. return(0);
  54. }//main
  55.  
Success #stdin #stdout 0s 5320KB
stdin
2
0
0
15
5
2
2
5
stdout
how many 1 euro cent is in the jar:
how many 2 euro cents is in the jar:
how many 5 euro cents is in the jar:
how many 10 euro cents is in the jar:
how many 20 euro cents is in the jar:
how may 50 euro cents is in the jar:
how many 1 euro coins is in the jar:
how many 2 euro coins is in the jar:

inside the jar is:15.520000 euros