Message-ID: <011201c0fb39$1457a610$4601a8c0@wladeira> From: =?iso-8859-1?Q?Andr=E9_Ladeira?= To: References: <9gsd0l$34e$1 AT news DOT clinet DOT fi> Subject: Re: Problem in Factorial Program Date: Fri, 22 Jun 2001 13:33:33 -0300 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 5.50.4133.2400 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4133.2400 Reply-To: djgpp AT delorie DOT com ----- Original Message ----- From: "Jyri Vahtera" Newsgroups: comp.os.msdos.djgpp To: Sent: Thursday, June 21, 2001 5:58 AM Subject: Problem in Factorial Program > Here is code: > > #include > long factorial(n) > int n; > > { > long result = 1; > while (n>1) { result = result*n; n = n - 1; } > return result; > } > > main() > { > } > > Where I put the main? > > Hi! I think i did not understand well your question, or what is wrong with your code but here goes some hints: Put something like this in main: printf("Enter a number:"); scanf("%d",&x); printf("%d factorial is %d\n",x,factorial(x));