delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2001/06/21/10:05:18

Date: Thu, 21 Jun 2001 16:22:51 +0300 (IDT)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
X-Sender: eliz AT is
To: Jyri Vahtera <jyrva AT mbnet DOT fi>
cc: djgpp AT delorie DOT com
Subject: Re: Problem in Factorial Program
In-Reply-To: <9gsd0l$34e$1@news.clinet.fi>
Message-ID: <Pine.SUN.3.91.1010621162150.10384F-100000@is>
MIME-Version: 1.0
Reply-To: djgpp AT delorie DOT com
Errors-To: nobody AT delorie DOT com
X-Mailing-List: djgpp AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

On Thu, 21 Jun 2001, Jyri Vahtera wrote:

> Here is code:
> 
> #include <stdio.h>
> 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?

int main (void)
{
  printf ("%ld\n", factorial (10));
  return 0;
}

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019