price, tip, tax given find total cost in round figure

#include<stdio.h>
#include<conio.h>
#include<math.h>
int main()
{
//price 12.00
//tip 20
//tax8
//Your Output 15
//round function in math.h headerfile
	double price;
	float tip,tax;
	scanf("%lf%f%f",&price,&tip,&tax);
	tip=(price/100)*tip;
	tax=(price/100)*tax;
	int total = (int)round(price+tip+tax);
	printf("%d",total);
	return 0;
}

OUTPUT

12.00  //price
20      //tip
8      //tax
15     total cost round figure.

Leave a comment