**1. (a) Design an algorithm, draw a corresponding flow chart and write a program in ‘C’, to find the factorial of a given number using recursion. 10****m Dec2008**

**Flowchart:**

**Code:**

#include<stdio.h>

void main()

{

int factorial();

int FACT,NUM;

clrscr();

printf(“ENTER NUMBER : “);

scanf(“%d”,&NUM);

if(NUM>0)

{

FACT=factorial(NUM);

printf(“\nFACTORIAL OF GIVEN NUMBER IS %d “,FACT);

}

else

printf(“\nERROR:GIVEN NUMBER IS %d NEGATIVE”,NUM);

getch();

}

int factorial(int N)

{

int RESULT;

if(N==1)

return(1);

else

RESULT=N*factorial(N-1);

return(RESULT);

}

```
#include<stdio.h>
void main()
{
int factorial();
int FACT,NUM;
clrscr();
printf("ENTER NUMBER : ");
scanf("%d",&NUM);
if(NUM>0)
{
FACT=factorial(NUM);
printf("\nFACTORIAL OF GIVEN NUMBER IS %d ",FACT);
}
else
printf("\nERROR:GIVEN NUMBER IS %d NEGATIVE",NUM);
getch();
}
int factorial(int N)
{
int RESULT;
if(N==1)
return(1);
else
RESULT=N*factorial(N-1);
return(RESULT);
}
```

** Screen Shots:**

**(b) Write a’C’ program to find whether a given five digits number is a palindrome. 10**

Solved program can be found on this link http://cssimplified.com/c-programming/write-a-recursive-program-in-c-to-find-whether-a-given-five-digit-number-is-a-palindrome-or-not-10m-dec2005

**(c) Write a program in’C’ to find all Armstrong numbers in the range of 0 and 999.**

**Hint: An Armstrong number is an integer such that sum of the cubes of its digits is equal to the number itself, e.g.: 153 is Armstrong number. 10**

Solved program can be found on this link http://cssimplified.com/c-programming/a-c-program-to-find-all-armstrong-numbers-in-the-range-of-0-to-999