Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- int main ()
- {
- double meal,cost1,tipA,taxA;
- int tip,tax,cost2;
- double num = 23.345;
- scanf("%lf",&meal);
- scanf("%d %d",&tip,&tax);
- tipA = meal * ((tip+0.00)/100);
- taxA = meal * ((tax+0.00)/100);
- cost1 = meal + tipA + taxA;
- int intpart = (int)cost1;
- double decpart = cost1 - intpart;
- if(decpart > 0.5)
- {
- intpart = intpart + 1;
- }
- printf("The total meal cost is %d dollars.",intpart);
- return 0;
- }
Add Comment
Please, Sign In to add comment