Kelidascope challenge bug | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
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;

26th Nov 2021, 4:47 PM
Angel Jimenez
Angel Jimenez - avatar
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
27th Nov 2021, 1:11 PM
SoloProg
SoloProg - avatar