Help C Programming!! Please!!

Status
Not open for further replies.

lankygiant16

Baseband Member
Messages
63
OK i know that i posted this on a different page...but i need help badly...my teacher sucks, no one in my class of about 20 students could to this damn factorial. Soooo...im kinda desperate right now. Heres what i have...and it STILL will not work:



#include <stdio.h>

int main (void)
{
int fac=1, i, num;

printf( "Enter a number: ");
scanf( "%i\n", &num);

for(i=1; i<=num; i++);
{

fac = fac * i;

printf("\nFactorial of Num is %i\n", fac);
}
return 0;
}




and what happens is i get the Enter number...i enter the number....then the program does nothing, so i enter the number again, and it gives an answer of the number entered + 1. So like if i entered in 10, it'd say the factorial is 11....which is wrong...and i dont know why its just adding one AND why its not even doing the loop. PLEASE HELP!!!!!!!!
 
Status
Not open for further replies.
Back
Top Bottom