Skip to content

Commit

Permalink
Added GCD example in C
Browse files Browse the repository at this point in the history
  • Loading branch information
iosdev747 authored Oct 8, 2018
1 parent 2fb4dfe commit dbcae17
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions GCD.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#include <stdio.h>
int main()
{
int n1, n2, i, gcd;
printf("Enter two integers: ");
scanf("%d %d", &n1, &n2);
for(i=1; i <= n1 && i <= n2; ++i)
{
if(n1%i==0&&n2%i==0)
{
gcd = i;
}
}
printf("G.C.D = %d",gcd);
return 0;
}

0 comments on commit dbcae17

Please sign in to comment.