Change the following C++ code to C code #include <iostream> using std::cout; usi
ID: 3615059 • Letter: C
Question
Change the following C++ code to C code#include <iostream>
using std::cout; using std::endl; using std::cin;
bool multiple( int, int );
int main() { int x, y;
for ( int i = 1; i <= 3; ++i ) { cout << "Enter two integers: "; cin >> x >> y;
if ( multiple( x, y ) ) cout << y << " is a multiple of " << x<< " "; else cout << y << " is not a multiple of "<< x << " "; }
cout << endl;
return 0; }
bool multiple( int a, int b ) { return !( b % a ); }
#include <iostream>
using std::cout; using std::endl; using std::cin;
bool multiple( int, int );
int main() { int x, y;
for ( int i = 1; i <= 3; ++i ) { cout << "Enter two integers: "; cin >> x >> y;
if ( multiple( x, y ) ) cout << y << " is a multiple of " << x<< " "; else cout << y << " is not a multiple of "<< x << " "; }
cout << endl;
return 0; }
bool multiple( int a, int b ) { return !( b % a ); }
#include <iostream>
using std::cout; using std::endl; using std::cin;
bool multiple( int, int );
int main() { int x, y;
for ( int i = 1; i <= 3; ++i ) { cout << "Enter two integers: "; cin >> x >> y;
if ( multiple( x, y ) ) cout << y << " is a multiple of " << x<< " "; else cout << y << " is not a multiple of "<< x << " "; }
cout << endl;
return 0; }
bool multiple( int a, int b ) { return !( b % a ); }
Explanation / Answer
Please Rate#include <iostream>
#include<conio.h>
bool multiple( int, int );
void main() { int x, y; clrscr(); //Clearscrean Contents
printf("Enter First integer:"); scanf("%d",x); ///Firstnumber is collected from the user printf("Enter Second integer:"); scanf("%d",y); ///Secondnumber is collected from the user
if(multiple( x, y)) //ifmutiple returns ture then this statement will execute printf("%d is a multiple of %d",y,x); else printf("%d is not a multipleof %d", y,x); } getch(); }
bool multiple( int a, int b ) { if( b % a==0) //if one number is fully divisiable by another number then both aremultiple of each other return true; else return false; } Hope you will get your answered }
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.