Tag Archives: recursive

Write a recursive program in ‘C’ to find the L.C.M. (Least Common Multiple) of two given numbers. 10m Dec2006

Write a recursive program in ‘C’ to find the L.C.M. (Least Common Multiple) of two given numbers. 10m Dec2006 #include<stdio.h> int lcm(int,int); void main() { int NUM1,NUM2,LCM; clrscr(); printf(“ENTER ANY TWO POSITIVE NUMBERS TO FIND ITS L.C.M. : “); scanf(“%d%d”,&NUM1,&NUM2); if(NUM1>NUM2) LCM = lcm(NUM1,NUM2); else LCM = lcm(NUM2,NUM1); printf(“LCM OF TWO NUMBERS IS %d”,LCM); getch();… Read More »

Write a recursive program in ‘C’ to find whether a given five digit number is a palindrome or not. 10m Dec2005

Write a recursive program in ‘C’ to find whether a given five digit number is a palindrome or not. 10m Dec2005 #include<stdio.h> int flag=0; void palin(int,int*); void main() { int a; clrscr(); printf(“Enter the number “); scanf(“%d”,&a); palin(a,&a); if(flag==0) printf(“\nThe number is palindrome…”); else printf(“\nThe number is not palindrome…”); getch(); } void palin(int x,int* y)… Read More »