0
Kelidascope challenge bug
When i input 3 i recieve a number with with 3 numbers after the decimal instead of 2, can someone tell me why? int main() { int buy; cin>>buy; double kaleidoscope=5; double saleP=buy*kaleidoscope; if (buy>=2){ saleP =saleP -saleP*.1; cout<<saleP+.07*saleP;} else cout<<saleP+.07*saleP;
1 Answer
+ 1
when you put the value input 3
It will give you boolean:true in the condition
value "saleP" = 3 * 5 = 15
saleP = 15 - (15*.1) = 13.5
print the result: 13.5 + (.07*13.5) = 14.445