Tuesday, 4 September 2012

WAP to find HFC and LCM of two number.

  •  WAP to find HFC and LCM of two number.
#include <stdio.h>
#include <conio.h>
void main()
{
    int a,b,c,p;
    printf("Enter two number to find LCM and HCF");
    scanf("%d\n",&a);
   scanf("%d",&b);
    p=a*b;
    do
    {
        c=(a%b);
        a=b;
        b=c;

        }
        while(a%b!=0);
        printf("HCF =%d",b);
        printf("LCM=%d",(p/b));
    }

No comments:

Post a Comment