2. Examine the following program. Imagine entering three numbers, and write what output you expect
#include <iostream.h>
int main() {
int a, b, c;
cout << "Please enter three numbersin":
cout << "a:
":cout << "\nb: ";
cin >> b;
cout << "\nc: ".
cin >> c:
if (c == (a-b))
{
cout << "a: ":
cout << a;
cout << "minus b: ";
cout << b;
cout << "equals c: ";
cout <<c<< endl;
}
else
cout << "a-b does not equal c: " << endl;
}
The output is:
Please enter three numbersin
a:1
b : 2
c: 3
a-b does not equal c:
Comments
Leave a comment