From 85aeac0a1df2c2d7890f122857f622f40506412a Mon Sep 17 00:00:00 2001 From: divyamgupta123 Date: Sat, 5 Oct 2019 18:48:41 +0530 Subject: [PATCH] New code for the repositery robotech It is the simple example of operators in C --- operators.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 operators.c diff --git a/operators.c b/operators.c new file mode 100644 index 0000000..b30a823 --- /dev/null +++ b/operators.c @@ -0,0 +1,20 @@ +#include +#include + +int main() { + double mealCost; + int tipPercent; + int taxPercent; + + scanf("%lf", &mealCost); + scanf("%d", &tipPercent); + scanf("%d", &taxPercent); + + double tip = mealCost * tipPercent / 100; + double tax = mealCost * taxPercent / 100; + int totalCost = (int) round(mealCost + tip + tax); + + printf("%d", totalCost); + + return 0; +}