ggorann

How much do you earn per day calculator

Oct 23rd, 2014
173
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.80 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <ctype.h>
  4. #include <string.h>
  5. #include <math.h>
  6.  
  7. /*
  8. How much do you earn per day calculator by Goran
  9. */
  10.  
  11. int main()
  12. {
  13.     float earnPerDay, day = 0, earnings = earnPerDay;
  14.     printf("How much do you earn per day? "); // asking user how much money he earns per day.
  15.     scanf(" %f", &earnPerDay); // gets input from user and stores it into float earnPerDay.
  16.     printf("\n"); // prints blank space.
  17.  
  18.     do{
  19.         printf("Day: %.0f Cash Earned: %.0f \n", day, earnings); // prints earnings for every day in month.
  20.         day++; // increment float day by one.
  21.         earnings += earnPerDay; // earnings float.
  22.     }while(day <= 31); // do code while day is less or equal to 31.
  23.  
  24.     printf("\n"); // prints blank space.
  25.     system("pause"); // pausing program after executing.
  26.     return 0;
  27. }
Add Comment
Please, Sign In to add comment