0
Cheer Creator
#include <iostream> using namespace std; int main() { int y; int i; cin>>y; if(y>=10){ cout<<"High Five"<<endl; }else if(y<1){ cout<<"shh"<<endl; }else if(y>=1 && y<10){ for(int x=0;x<y;x++){ cout<<"Ra!"<<endl; } } return 0; } why does the fourth test fail?
3 ответов
+ 3
Francesco Famosi
y should be greater than 10 only so change to y > 10
And remove if condition from final else because it doesn't make sense because when y will be within range 1 to 10 then finally else part will automatically execute.
if(y > 10) {
cout << "High Five" << endl;
} else if(y < 1) {
cout << "shh" << endl;
} else {
for(int x = 0; x < y; x++) {
cout << "Ra!" << endl;
}
}
return 0;
}
+ 2
Lalala
i is a short of iteration so mostly people use i but we can use anything
+ 1
A͢J why you added x and what the point of using i