Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- int main()
- {
- int num1, num2, i, gcd;
- printf("Enter two numbers : ");
- scanf("%d %d", &num1, &num2);
- for(i = 1; i <= num1 && i <= num2; i++)
- {
- if((num1 % i == 0) && (num2 % i == 0))
- gcd = i;
- }
- printf("\nThe GCD of %d & %d is : %d\n", num1, num2, gcd);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement