+ 1

WHAT IS INCORRECT IN THIS CODE ?

#include <iostream> using namespace std; int main() { int canav,color,tax,clr,ttl0; canav = 40; cin>>color; clr = color * 5; ttl0 = clr + canav; tax = (10/100) * ttl0 ; int ttl = tax+canav+clr; cout<<ttl; return 0; }

3rd Sep 2020, 1:45 AM
Nikunj Vashishtha
Nikunj Vashishtha - avatar
1 Answer
+ 2
There's a couple things, first tax should be a float, 1.1 to be exact. The equation for sales and calculating sales tax is tax*(canav+clr). Also, your final total needs to be rounded, so you're gonna need cmath, I hope this helps
3rd Sep 2020, 2:04 AM
Steven M
Steven M - avatar