From 0e41709107738577a1c516c6d625264228f4a8e7 Mon Sep 17 00:00:00 2001 From: Prateek-Jain21 <114493541+Prateek-Jain21@users.noreply.github.com> Date: Mon, 10 Oct 2022 21:30:49 +0530 Subject: [PATCH] Greatest_Common_Divisor.c --- C/Greatesr_Common_Divisor.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 C/Greatesr_Common_Divisor.c diff --git a/C/Greatesr_Common_Divisor.c b/C/Greatesr_Common_Divisor.c new file mode 100644 index 0000000..c092163 --- /dev/null +++ b/C/Greatesr_Common_Divisor.c @@ -0,0 +1,15 @@ +#include +void main() +{ int n1,n2,t,i; + printf("Enter The Two Numbers \n"); + scanf("%d%d",&n1,&n2); + if(n2>n1) + {t = n1; + n1= n2; + n2 = t;} + for(i = n2;i>0;i--) + {if(n1%i==0&&n2%i==0) + { printf("%d \n",i); + break;} +} +}