Advertisement
Guest User

Untitled

a guest
Jun 20th, 2019
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.28 KB | None | 0 0
  1. #include <stdio.h>
  2. int main()
  3. {
  4.     int n1, n2;
  5.  
  6.     printf("Enter two positive integers: ");
  7.     scanf("%d %d",&n1,&n2);
  8.  
  9.     while(n1!=n2)
  10.     {
  11.         if(n1 > n2)
  12.             n1 -= n2;
  13.         else
  14.             n2 -= n1;
  15.     }
  16.     printf("GCD = %d",n1);
  17.  
  18.     return 0;
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement