What's problem in this program? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

What's problem in this program?

#include <iostream> using namespace std; int main() { int marks; if (marks>=50); { cout<<"add 10 percent"; } else { cout<<"fail"; } return 0; }

29th Oct 2023, 10:49 AM
Haram Abbas
Haram Abbas - avatar
2 Answers
+ 2
Did you take input? marks and semicolon should not be after if block
29th Oct 2023, 10:55 AM
A͢J
A͢J - avatar
+ 1
on line 6 : you used a semicolon which cause error , cuz in if/else statement we use '{}' not ';'
30th Oct 2023, 6:05 AM
Alhaaz
Alhaaz - avatar