Telaryon

LNKO

Mar 17th, 2017
87
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 main(void){
  4.  
  5.     int s1;
  6.     int s2;
  7.  
  8.     printf("szam1 szam2: ");
  9.     scanf("%d %d", &s1, &s2);
  10.  
  11.     printf("lnko(%d, %d)=%d", s1, s2, lnko(s1, s2));
  12.     return 0;
  13. }
  14.  
  15. int lnko(int a, int b){
  16.  
  17.     int temp;
  18.  
  19.     while(b>0){
  20.         temp = b;
  21.         b = a%b;
  22.         a = temp;
  23.     }
  24.     return a;
  25. }
Advertisement
Add Comment
Please, Sign In to add comment