//greatest common divisor
//Highest Common Factor
// Find Highest Common Factor with C Program .
#include<stdio.h>
int main(){
int i,j,k,gcd;
printf("Please Enter First Number:");
scanf("%d",&j);
printf("Please Enter Second Number:");
scanf("%d",&k);
for(i=1;i<=j||i<=k;++i){
if(j%i==0&&k%i==0){
gcd=i;
}
}
printf("\nThe greatest common divisor of %d and %d is : %d\n",j,k,gcd);
return 0;
}
Result :
//Highest Common Factor
// Find Highest Common Factor with C Program .
#include<stdio.h>
int main(){
int i,j,k,gcd;
printf("Please Enter First Number:");
scanf("%d",&j);
printf("Please Enter Second Number:");
scanf("%d",&k);
for(i=1;i<=j||i<=k;++i){
if(j%i==0&&k%i==0){
gcd=i;
}
}
printf("\nThe greatest common divisor of %d and %d is : %d\n",j,k,gcd);
return 0;
}
Result :
কোন মন্তব্য নেই:
একটি মন্তব্য পোস্ট করুন