Get premium membership and access questions with answers, video lessons as well as revision papers.

Here is a C program. Rewrite it so it uses C++ style I/O statements. /* convert this C program into C++ style.This program computes the lowest...

      

Here is a C program. Rewrite it so it uses C++ style I/O statements.

/* convert this C program into C++ style.This program computes the lowest common denominator*/
#include
into main (void)
{
int a, b, min ;
printf("Enter two numbers: ");
scanf("%d%d",&a, &b);
min = a > b ? b:a;
for (d = 2; dif(((a%d) ==0) && ((b%d) ==0)) break;
if (d== min) {
printf("No common denominators\n");
return 0;
}
printf("The lowest common denominator is %d\n", d);
return 0;
}

  

Answers


Davis
/*
This program computes the lowest common denominator.
*/
#include
using namespace std;
into main(){
int a, b, d, min;
court << "Enter two numbers:";
cin >> a>> b;
min = a>b?b:a;
for(d=2; dif(((a%d)==0) && ((b%d==0)) break;
if (d==min){
cout << No common denominators\n";
return 0;
}
cout << "The lowest common denominator is "<return 0;
}
Githiari answered the question on April 30, 2018 at 13:50


Next: Tamu Limau is a senior partner in a real estate business. He would like to know whether to continue the business as a partnership or convert...
Previous: Give four reasons why levees and raised river beds increase flooding

View More Computer Studies Questions and Answers | Return to Questions Index


Learn High School English on YouTube

Related Questions