Skip to content

Instantly share code, notes, and snippets.

@mbszarek
Created May 24, 2017 22:49
Show Gist options
  • Save mbszarek/36fb6170adca20754bf41b1eb534a8da to your computer and use it in GitHub Desktop.
Save mbszarek/36fb6170adca20754bf41b1eb534a8da to your computer and use it in GitHub Desktop.
#include <stdio.h>
int nwd(int a, int b){
int c;
while(b!=0){
c=a%b;
a=b;
b=c;
}
return a;
}
int main(){
int a,b;
printf("Podaj a: ");
scanf("%d",&a);
printf("Podaj b: ");
scanf("%d",&b);
printf("NWD %d %d to %d",a,b,nwd(a,b));
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment