Q&A Discussies
Python Else-If
0 Stemmen
4 AntwoordenElse-If Statements
0 Stemmen
1 AntwoordAbout else-if statement
0 Stemmen
1 AntwoordHelp!!
1 Stem
7 Antwoorden<h1> syntax in 16.1
1 Stem
3 Antwoordenwhy 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 AntwoordenПочему не работает?
0 Stemmen
2 AntwoordenPopulair vandaag
Pointers cpp
3 Votes
Is pro worth the money ?
1 Votes
Coding for Cybersecurity
0 Votes
Pointers in c#
0 Votes
Drawing images in java
2 Votes