Advertisement
Vasilena

PracticeDayThreeExercise7

Jul 8th, 2021
193
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.33 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. int nod(int a, int b)
  4. {
  5.     if (a == 0)
  6.         return b;
  7.     return nod(b%a, a);
  8. }
  9.  
  10. int main()
  11. {
  12.     int a, b;
  13.     printf("Enter a: ");
  14.     scanf("%d", &a);
  15.     printf("Enter b: ");
  16.     scanf("%d", &b);
  17.     printf("Greatest common divisor of %d and %d is: %d", a, b, nod(a, b));
  18.     return 0;
  19. }
  20.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement