Вы находитесь на странице: 1из 1

#include <iostream>

using namespace std;

int gcd(int a, int b) {

if (b == 0)

return a;

return gcd(b, a % b);

int main() {

int a , b , x , y ;

cout<<"Enter the values of a and b: "<<endl;

cin>>a>>b;

cout<<"Enter the values of x and y: "<<endl;

cin>>x>>y;

cout<<"\nA= "<< a <<" \t B= "<< b <<”\t x= "<< x<<” \ty= "<< y ;

cout<<"A*x="<< a*x <<" \t B*y= "<< b*y ;

cout<<"GCD of "<< a*x <<" and "<< b*y <<" is "<< gcd(a*x, b*y);

return 0;

Вам также может понравиться