Q&A Discussies
why does this code output that there is an error because the else statement doesn't have a corresponding if statement?. How do i correct this?
#include <iostream>
using namespace std;
int main() {
int a;
for (int x =0; x<5;x++){
cin>>a;
if (a<1){
cout<<"a cannot be less than 1\n";
}
else if (a>10){
cout <<"a cannot be greater than 10\n";
}
}
else{
cout<<"code can run now"<<endl;
}
return 0;
}
3 Stemmen
8 Antwoorden2
-6 Stemmen
2 AntwoordenPopulair vandaag
Help
1 Votes
Python stressed me out
1 Votes
Course Doubt
1 Votes
Data analysis
0 Votes
Help
0 Votes
How do i make a lexer and parser
1 Votes