Programming C Tutorial
--------------------------------------------------------------------------------------
Friday, June 10, 2011
Write a c program to find out H.C.F. of two numbers.
#include
<stdio.h>
int
main(){
int
x,y,m,i;
printf(
"Insert any two number: "
);
scanf(
"%d%d"
,&x,&y);
m=x
for
(i=m;i>=1;i--){
if
(x%i==0&&y%i==0){
printf(
"\nHCF of two number is : %d"
,i) ;
break
;
}
}
return
0;
}
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment