Kaleidoscope Code Challenge | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Kaleidoscope Code Challenge

Need help figuring out why this code is failing the last test case. <remove description of challenge as SoloLearn requires. Wells> #include <stdio.h> int main() { int kl; float cost = 5.00; scanf("%d", &kl); if(kl <= 1) printf("%.2f", kl*cost*1.07); else printf("%.2f", kl*cost*.9*1.07); return 0; }

7th Mar 2020, 4:04 AM
Dion Rainey
11 Answers
+ 1
Oops, this is pro content, i cannot see it without charging. 😢
8th Mar 2020, 6:11 PM
Akbar Ali Quazi
Akbar Ali Quazi - avatar
+ 1
It's alright,I'll get it eventually haha. Thanks for your help anyway
8th Mar 2020, 6:13 PM
Dion Rainey
0
What is the problem?
8th Mar 2020, 7:08 AM
Akbar Ali Quazi
Akbar Ali Quazi - avatar
0
Akbar Ali Quazi the description was removed, but it was asking this: If a person buys more than one kaleidoscope they get a 10% discount. Given the 10% discount, a cost of 5$ per kaleidoscope and a sales tax of 7% give the user their total.
8th Mar 2020, 4:32 PM
Dion Rainey
0
Okay then what's wrong in this code?
8th Mar 2020, 4:36 PM
Akbar Ali Quazi
Akbar Ali Quazi - avatar
0
I fail the 5th case check in the code challenge but it's locked so I can't see where I went wrong.
8th Mar 2020, 4:38 PM
Dion Rainey
0
Try this #include<stdio.h> void main() { int kl=0; float cst = 5; printf("\nEnter Kaleidoscope : "); scanf("%d",&kl); if(kl>1) printf("\nAmout : %.2f\n",cst*kl*.9*1.07); else printf("\nAmout : %.2f\n",cst*kl*1.07); }
8th Mar 2020, 5:48 PM
Akbar Ali Quazi
Akbar Ali Quazi - avatar
0
Didn't work, still failing 5th case
8th Mar 2020, 5:58 PM
Dion Rainey
0
Share me the link, there r u facing this problem
8th Mar 2020, 6:00 PM
Akbar Ali Quazi
Akbar Ali Quazi - avatar
8th Mar 2020, 6:02 PM
Dion Rainey
0
Happy to help 🤗
8th Mar 2020, 6:22 PM
Akbar Ali Quazi
Akbar Ali Quazi - avatar