Sie sind auf Seite 1von 1

DEPARTMENT OF CS AND IT

LYALLPUR KHALSA COLLEGE,JALANDHAR.


Write a program to find HCF of two numbers.
#include<stdio.h>
#include<conio.h>
void main()
{
int x,y,r,a,b;
printf(\n Enter two positive integers:);
scanf(%d.%d,&a,&b);
x=a;
y=b;
do
{
r=x%y;
x=y;
y=r;
}
while(r!=0);
printf(\n HCF of %d and %d =%d, a,b,x);
getch();
}

Output:
Enter two numbers : 10 , 15
HCF : 5

LKC/DCS/BCA-1/9950/2011-2012

SIGN:

Das könnte Ihnen auch gefallen