I am writing an if else statement where i need to see if the sum of two numbers in equal to, greater than or less than 100. I put in this code down below, and when i compile it , it shows two of the statements.
1 2 3 4 5 6
if (a + b > 100)
cout << "The sum of these numbers is less than 100." << endl;
if (a + b == 100)
cout << "The sum of these numbers is equal to 100." << endl;
else
cout << "The sum of these numbers is greater than 100." << endl;
if ((a + b) < 100)
{
cout << "The sum of these numbers is less than 100." << endl;
}
elseif ((a + b) == 100)
{
cout << "The sum of these numbers equal to 100." << endl;
}
else
{
cout << "The sum of these numbers is greater than 100." << endl;
}