Else-statement | Sololearn: Learn to code for FREE!
¡Nuevo curso! ¡Todo programador debería aprender IA Generativa!
Prueba una lección gratuita
0

Else-statement

Here condition is false, but it outputs “else” statement. Why???? #include <iostream> using namespace std; int main() { int mark = 90; if (mark < 50) { cout << "You failed." << endl; cout << "Sorry" << endl; } else { cout << "Congratulations!" << endl; cout << "You passed." << endl; cout << "You are awesome!" << endl; } return 0; }

15th Jun 2018, 3:33 PM
Aksh97
Aksh97 - avatar
2 Respuestas
0
thanks i just forget. if condition is wrong there will be no output and executes else statement
15th Jun 2018, 3:38 PM
Aksh97
Aksh97 - avatar
0
thank you for quick response
15th Jun 2018, 3:39 PM
Aksh97
Aksh97 - avatar