English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

2006-12-21 20:29:20 · 4 answers · asked by er.manassamal83 1 in Computers & Internet Hardware Monitors

4 answers

Dear,

U joined today. Welcome.... U will surely find u r answers.

Here it is:

void main()
{
int num;
long int factorial;
factorial=1;
printf("\n Enter a number : ");
scanf("%d",&num);
while(num>=1)
{
factorial= factorial * num;
num=num-1;
}
printf("\n The factorial is %ld.",factorial);
}

OM NAMAH SHIVAY

2006-12-22 03:57:45 · answer #1 · answered by Gurudev 3 · 0 0

#include

int factorial (int n)
{
if (n == 0)
return 1;
else
return (n * factorial (n-1));
}

/* To shorten example, not using argp */
int main ()
{
printf ("%d\n", factorial(3)); // give the required number
return 0;
}

2006-12-22 04:40:21 · answer #2 · answered by TuRbOmAcH 1 · 0 0

not a nice question to be asked this is a very simple one and u can easily get into it

2006-12-22 04:58:24 · answer #3 · answered by sweetboy 3 · 0 1

#include
#include
#include
void main()
{
int a,num,fact;
fact=1;
printf("Enter the number");
scanf("%d",&num);
flushall();
system("cls");
for(a=1;a<=num;a++)
fact=fact*a;
printf("The factorial is %d",fact);
getch();
}

2006-12-25 23:56:08 · answer #4 · answered by rocky9281 1 · 0 0

fedest.com, questions and answers