#include<stdio.h> 
#include<conio.h> 
void main() 
{ 
int n,f; 
f=1; 
printf("Enter the number:\n"); 
scanf("%d",&n); 

while(n>0) 
{ 
printf("%d",n); 
f=f*n; 
n--; 
} 
printf("The factorial of the integer is:%d",f); 
getch(); 
}

I want you to ask a smart question, but apparently neither of us are getting what we want.

#include<stdio.h>
#include<conio.h>
void main()
{
int n,f=1,i,j;
clrscr();
printf("enter the number");
scanf("%d",&n);

if(n>0)
{
j=1;
for(i=0;i<n;i++)
{
f=f*j;
j++;
}
}
printf("the factorial of the number is %d",f);
getch();
}

commented: In the words of Narue -- epic fail -2

Posting bad code badly with no comments is not helpful. Please refrain and stick to asking for help. Or actually, start asking. You need to learn before you can help.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.