April 15, 2021, 04:46:46 AM

Poll

need help with assignment

imple
0 (0%)

Total Members Voted: 0

Author Topic: help with homework  (Read 5794 times)

0 Members and 1 Guest are viewing this topic.

omahne

  • Guest
help with homework
« on: April 17, 2004, 03:46:12 PM »
ok, i need help.  i have to submit a homework assignment, beginner, and i am clueless.  i need to write a program that uses for structure to evaluate the factorials of the integars from 1 to 5.  please help.  failing!!!

Offline Metgod

  • the deranged hacker
  • Administrator
  • Forum Hero
  • *****
  • Posts: 1116
  • Country:
  • Gender: Male
Re:help with homework
« Reply #1 on: April 21, 2004, 04:38:19 PM »
Define 'for structure' ?

Do you mean 'for loop' ?

There is a difference, and I can't see a structure being used in this. I would suggset that you read up on both topics; C (or C++ if you use that instead) and factorials...

a for loop usually has the format of ..

for (initialization of variables; check; increment/next evaluation) {

code

}

The following example will print out a number, 0 through 5, on a seperate line each ...

int i;

for (i = 0; i < 6; i++)
{
printf("I is now %d", i);
}

You could use a very similar for loop if you're on about a number 1 - 5.. just modify it to your liking.

That's about all I have energy to explain though ...

BTW: You need to read _and_ experiment. If you rely on others, you won't get anywhere ....

Met
"My Terminal is my Soul"