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
1
Expert's answer
2013-05-15T09:32:45-0400
// 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 the first!

Leave a comment

LATEST TUTORIALS
APPROVED BY CLIENTS