63 076
Assignments Done
99,1%
Successfully Done
In July 2018

Answer to Question #30166 in C++ for taha

Question #30166
i have home task can u guide me .take input of two numbers,until both number are divisble by 2 and three.it ask u to take input again and again when result comes .it show table of both numbers.....plzz
Expert's answer
// 11.cpp : Defines the entry point for the console application.
//

#include <iostream>

using namespace std;

int main()
{
int n1, n2; // numbers for entering
do // using do-while construction
{
cout << "---Please enter the numbers---\n"; // asking for entering
cout << "first number: ";
cin >> n1; // enter 1-st number
cout << "second number: ";
cin >> n2; // enter 2-nd number
}
while ( (n1 % 3 != 0) || (n1 % 2 != 0) || (n2 % 3 != 0) || (n2 % 2 != 0) ); // test for divisibility by 2 and 3.
//We do all that are calling in do{} until condition in while became false.
cout << "You entered: " << n1 << " and " << n2 << ".\n"; // write result
}

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 first!

Leave a comment

Ask Your question

Submit
Privacy policy Terms and Conditions