Go Back   Computer Forums > Welcome To Computer Forums .org > Social Lounge | Off Topic
Join Computer forums Today

Closed Thread
Thread Tools Search this Thread Display Modes
Old 09-26-2006, 11:48 PM   #1
Baseband Member
lankygiant16's Avatar
Join Date: Aug 2006
Posts: 63
Default Help C Programming!! Please!!

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!!!!!!!!

lankygiant16 is offline  
Old 09-27-2006, 12:54 AM   #2
Golden Master
ArrizX's Avatar
Join Date: Apr 2005
Posts: 16,069
Send a message via MSN to ArrizX
Default Re: Help C Programming!! Please!!



. ()()()()
./l ,[_\_\ ],
l---L – ()lllllll()-
()_) ()_)--o-)_)
ArrizX is offline  
Old 09-27-2006, 04:27 AM   #3
Site Team
root's Avatar
Join Date: Mar 2004
Posts: 7,872
Default Re: Help C Programming!! Please!!

I didn’t fight my way to the top of the food chain to be a vegetarian…
Im sick of people saying 'dont waste paper'. If trees wanted to live, they'd all carry guns.
"The inherent vice of capitalism is the unequal sharing of blessings; The inherent vice of socialism is the equal sharing of miseries."
root is offline  
Closed Thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

All times are GMT -5. The time now is 06:46 AM.

Powered by vBulletin® Version 3.8.8 Beta 4
Copyright ©2000 - 2016, vBulletin Solutions, Inc.
Search Engine Friendly URLs by vBSEO 3.6.0