Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <math.h>
- #include <cstdio>
- using namespace std;
- int main(){
- int a, b;
- printf("enter two numbers a, b: ");
- while(scanf("%d%d", &a, &b) == 2){
- while (b > a){
- b -= a;
- while (a > b)
- a -= b;
- }
- while (a > b){
- a -= b;
- while (a > b)
- b -= a;
- }
- if (a == b)
- printf("gcd = %d", a);
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement