76 951
Assignments Done
Successfully Done
In June 2019

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.
Expert's answer
#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!


No comments. Be first!

Leave a comment

Ask Your question

Privacy policy Terms and Conditions