0

Please what's wrong with this code.

#include <iostream> using namespace std; int main() { int a,b; cout << "please enter a number\n"; cin >> a; cout << "Enter another"; cin >> b; If(a > b) { cout << "The first number is greater than the second number"; } If(a < b) { cout << "The second number is greater than the first number"; } If(a == b) { cout << "The first number is equal to the second number"; } return 0; }

17th Nov 2016, 12:21 PM
Eje Nathaniel
Eje Nathaniel - avatar
4 Answers
+ 1
Hi, Seems like you used capitol I in the if keyword. If you change all the I's it works like a charm. int main() { int a, b; cout << "please enter a number: "; cin >> a; cout << "Enter another: "; cin >> b; if(a > b) { cout << "The first number is greater than the second number"; } if(a < b) { cout << "The second number is greater than the first number"; } if(a == b) { cout << "The first number is equal to the second number"; } return 0; }
17th Nov 2016, 12:32 PM
Ove Sletta
+ 1
Ove Sletta is right. Swap I for i and it works.
17th Nov 2016, 1:22 PM
MarcinPL
MarcinPL - avatar
0
Thanks so much @ Sletta and Marcin. I really appreciate your contribution.
17th Nov 2016, 1:28 PM
Eje Nathaniel
Eje Nathaniel - avatar
0
Its if not If
28th Nov 2016, 7:26 AM
kianush