Advertisement
Guest User

Untitled

a guest
Apr 28th, 2017
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.29 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. int main()
  4.  
  5. {
  6.     int n1,n2,i,gcd;
  7.     printf("Enter the number: \n");
  8.  
  9.     scanf("%d%d",&n1,&n2);
  10.  
  11.     for(i=0;i<=n1&&i<=n2;i++)
  12.     {
  13.         if(n1%i==0 && n2%i==0)
  14.         {
  15.             gcd=i;
  16.         }
  17.  
  18.     }
  19.  
  20.     printf("%d",gcd);
  21.  
  22.     return 0;
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement