Ho creato un programma che passato un valore intero restituisce il suo fattoriale ma mi da un errore strano :
codice:
mattia@mattia-MS-7529:~/Scrivania/C funzioni$ gcc -o LonziMattia_Fattoriale LonziMattia_Fattoriale.c
/tmp/ccB0bIKu.o: In function `main':
LonziMattia_Fattoriale.c: (.text+0x38): undefined reference to `print'
collect2: ld returned 1 exit status
codice:
/*
* PROGRAMMA CHE DATO IN INPUT UN VALORE STAMPA IL SUO FATTORIALE
*
* @author Lonzi Mattia
* @version 0.1 2012-12-18
*/
#include <stdio.h>
int fattoriale() {
int numero;
int fattoriale;
int i = numero;
while(i > 0) {
fattoriale = numero * i;
i--;
}
return fattoriale;
}
void main() {
int numero;
int fattoriale;
print("INSERIRE NUMERO");
scanf("%d", &numero);
printf("il fattoriale del numero inserito è %d", fattoriale);
}
Potreste spiegarmi il problema?? GRAZIE IN ANTICIPO
PS : Il mio professore non passava i valori con scanf direttamente nella funzione ma lo fa nel main...Non so che differenza faccia ... Potreste spiegarmela ?? Grazie