comp.lang.ada
 help / color / mirror / Atom feed
* Help with Translation, please!
@ 1996-02-26  0:00 Robert Gelb
  1996-02-27  0:00 ` Pascal OBRY
  0 siblings, 1 reply; 3+ messages in thread
From: Robert Gelb @ 1996-02-26  0:00 UTC (permalink / raw)


I am having a hell of a time translating a little recursive factorial 
program from C to Ada.  Could some please help me.  Below is the C code 
that needs to be translated to ADA


#include <stdio.h>
int factorial(int);

int main() {
	long f;
	int number;

	printf("\nPlease enter factorial number:");
	scanf("%d", &number);	/*get the factorial number*/
	f = factorial(number);  /*invoke factorial function*/
	printf ("Result: %ld", f);
	return 0;
}

int factorial(int n) {
	int ReturnValue;
	if (n > 1)
		ReturnValue = n * factorial(n-1);
	else
		ReturnValue = 1;

	return ReturnValue;
}






^ permalink raw reply	[flat|nested] 3+ messages in thread
[parent not found: <4gvta2$531@ds8.scri.fsu.edu>]

end of thread, other threads:[~1996-03-15  0:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1996-02-26  0:00 Help with Translation, please! Robert Gelb
1996-02-27  0:00 ` Pascal OBRY
     [not found] <4gvta2$531@ds8.scri.fsu.edu>
     [not found] ` <4h2gu9$hp6@watnews1.watson.ibm.com>
1996-03-15  0:00   ` Robert I. Eachus

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox