View Code of Problem 59

#include<iostream>
using namespace std;
int main()
{ int a,b,gys,ybs;
 cin>>a>>b;
 for(gys=a;!(a%gys==0 && b%gys==0);gys--);
 for(gbs=a;!(gbs%a==0 && gbs%b==0);gbs+=a);
 cout<<gbs<<" "<<gys<<endl;
 return 0;
}
/*
Main.cc: In function 'int main()':
Main.cc:7:6: error: 'gbs' was not declared in this scope
  for(gbs=a;!(gbs%a==0 && gbs%b==0);gbs+=a);
      ^
Main.cc:8:8: error: 'gbs' was not declared in this scope
  cout<<gbs<<" "<<gys<<endl;
        ^
Main.cc:4:15: warning: unused variable 'ybs' [-Wunused-variable]
 { int a,b,gys,ybs;
               ^
*/

Double click to view unformatted code.


Back to problem 59