Answer to Question #31251 in C++ for saqib Ali

Question #31251
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;
}
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS