Write a program to get three numbers from user for integer variables a, b and c. If a isnot zero, find out whether it is the common divisor of b and c.
1
Expert's answer
2013-05-29T07:56:27-0400
#include <iostream> using namespace std;
int main() { int a, b, c; cout << "Input a: "; cin >> a; cout << "Input b: "; cin >> b; cout << "Input c: "; cin >> c; if (a != 0) { & if (b % a == 0 && c % a == 0) cout << "a is common divisor of b and c"; & else cout << "a isn't a common divisor of b and c"; & cout << endl; } }
Comments
Leave a comment