Discussions Q&R
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 Votes
8 RéponsesJava data types vs. JS
12 Votes
1 RéponseHow to achive this task
2 Votes
1 RéponsePlz explain output?
0 Vote
2 RéponsesIndexers Questions
3 Votes
2 RéponsesMeaning of "int total"
1 Vote
2 RéponsesPlease help in this code
3 Votes
8 RéponsesInteger's digits.
0 Vote
2 RéponsesI NEED explaination
14 Votes
12 Réponsesc++
1 Vote
3 RéponsesAujourd'hui en vedette
What is a web browser intension?
1 Votes
Thread local : global vs local
0 Votes
Postgrrsql and python
0 Votes
Codding lern
0 Votes
Data Analysis Course
1 Votes
Is there LUA?
0 Votes
tabla empleados sql
0 Votes
Web vs python
0 Votes