the main source code of this programme is:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include<stdio.h> | |
#include<conio.h> | |
int hcf(int,int); | |
int main() | |
{ | |
int a,b,x; | |
printf("Enter the num whose hcf is to be find"); | |
scanf("%d%d",&a,&b); | |
x=hcf(a,b); | |
printf("\n hcf of the entered number=%d",x); | |
getch(); | |
} | |
int hcf(int a,int b) | |
{ | |
int r; | |
while (r!=0) | |
{ | |
r=a%b; | |
if (r==0) | |
return b; | |
else | |
a=b; | |
b=r; | |
} | |
} |
0 comments :
Post a Comment