View Single Post
Old 07-11-2007, 22:10   #4
jappilas
Senior Member
 
L'Avatar di jappilas
 
Iscritto dal: Apr 2003
Città: Genova
Messaggi: 4741
Quote:
Originariamente inviato da cecce88
<...>cosa sbaglio?<...>
che se imponi i > x , il ciclo non è eseguito perchè quella condizione non si verifica mai
Quote:
Originariamente inviato da andbin Guarda i messaggi
Non so a memoria come è l'algoritmo per tale calcolo ma la tua funzione fibo() non mi sembra corretta. Mi riferisco innanzitutto al ciclo for.
in forma ricorsiva:
Codice:
int fibo(int x)
{
	if (x==0)
		return 0;
	else
		if (x==1)
			return1;
		else 
			return (fibo(x-1) + fibo(x-2));
}
edit: chiedo scusa
__________________
Jappilas is a character created by a friend for his own comic - I feel honored he allowed me to bear his name
Saber's true name belongs to myth - a Heroic Soul out of legends, fighting in our time to fullfill her only wish
Let her image remind of her story, and of the emotions that flew from my heart when i assisted to her Fate
jappilas è offline   Rispondi citando il messaggio o parte di esso