Advertisement
Guest User

as

a guest
Mar 5th, 2015
188
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.33 KB | None | 0 0
  1. #include <stdlib.h>
  2.  
  3. int main()
  4. {   int n = 0;
  5.     int m = 0;
  6.     printf("Program do liczenia NWD\n");
  7.     printf("Podaj pierwszą liczbę: ");
  8.     scanf("%d",& n);
  9.     printf("Podaj drugą liczbę: ");
  10.     scanf("%d",& m);
  11.     do{ if(n>m){
  12.         n=n-m;
  13.     }else{
  14.         m=m-n
  15.     }
  16.     }while(n!=m);
  17.     printf("NWD to: %d", n);
  18.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement