Docstoc

GCD

Document Sample
GCD Powered By Docstoc
					/* Write a Program for to find the GCD of two numbers */
int gcd(int,int)
void main()
  {
    int no1,no2,ans;
    clrscr();
    printf("Enter Integer Number : ");
    scanf("%d",&no1);
    printf("Enter Second Number: ");
    scanf("%d",&no2);
    ans = gcd(no1,no2);
    printf("GCD of two Number is : %d",ans);
  getch();
}

int gcd(int m,int n)
  {
    if(n == 0)
       return m;
    else
      gcd(n,(m%n));
  }

				
DOCUMENT INFO
Shared By:
Categories:
Tags:
Stats:
views:60
posted:3/21/2010
language:English
pages:1
Description: gtu-mca.blogspot.com