+ 1

What is wrong in this code for 'Cheer creator'?

#include <stdio.h> int main() { int yard,i; scanf("%d",&yard); if(yard>10) { printf("High five"); for(i=0;i<yard;i++) { printf("Ra!"); } } if(yard<1){ printf("shh"); } if(yard>1 && yard<=10) { for(i=0;i<yard;i++) { printf("Ra!"); } } return 0; }

29th Oct 2020, 11:24 AM
Shivam Mishra
Shivam Mishra - avatar
5 Antworten
+ 1
It should not print "Ra!" if yard > 10. Also, it fails to print "Ra!" when yard == 1.
29th Oct 2020, 11:35 AM
Brian
Brian - avatar
+ 1
Brian in 7th line i use to print Ra if yard >10
29th Oct 2020, 11:42 AM
Shivam Mishra
Shivam Mishra - avatar
+ 1
Yes, Shivam Mishra, but the instructions are to only print "High five" if yard > 10. Remove that loop. Also correct the condition so that it includes yard == 1 when printing "Ra!".
29th Oct 2020, 11:46 AM
Brian
Brian - avatar
+ 1
It is not working bro
29th Oct 2020, 12:47 PM
Shivam Mishra
Shivam Mishra - avatar
+ 1
Thank u all
29th Oct 2020, 1:02 PM
Shivam Mishra
Shivam Mishra - avatar