Salem
Posting Sage
11,531 posts since Dec 2005
Reputation Points: 5,862
Solved Threads: 953
We'll help once you demonstrate you'ev done *something* other than just post for help, please give us your pseudo code and the start of what you have.
LizR
Posting Virtuoso
1,791 posts since Aug 2008
Reputation Points: 196
Solved Threads: 190
OK, well. Research how to do the pascals triangle first. Thats fundemental that you need for your app.
LizR
Posting Virtuoso
1,791 posts since Aug 2008
Reputation Points: 196
Solved Threads: 190
I dont let anyone talk to me by MSN, its the work of the devil.
Anyway, while Im still not going to write your code for you, think how a factorial works. In fact, the answer is more simple than you think.
your teachers is getting you to use a specific type of coding, deliberately, and I guess I'll have to tell you the name of it, but, it kinda defeats the purpose of your home work..
You need to use a recursive function, eg, one that calls itself.
Im hoping you know what factorials are.
for those who come across this and dont (shame on you), a factorial is the result of taking a number "n" and multiplying it by all of the numbers below it.. eg 4! would be 4*3*2*1 (although theres no point of *1)
so, what you guys need to do is write a function that does that.
The most common way is a recursive function, although you dont *need* to, but, Id still argue you should.
Now you see if you can code it.. Theres 2 really obvious ways.
LizR
Posting Virtuoso
1,791 posts since Aug 2008
Reputation Points: 196
Solved Threads: 190
A factorial is a factorial, and Im not a "dude"
(i-j)! could be (10-5)! which is 5! which has a specific value and never changes and I explained to those who didnt know what a factorial was, how to do it.
At the same time its not uncommon to need to do something like i!-j! which would be 10! - 5! and then that also is a fixed value.
if you dont know what recursion means, please check this link
LizR
Posting Virtuoso
1,791 posts since Aug 2008
Reputation Points: 196
Solved Threads: 190
Your post is not going to get you answers, the reminder of what a factorial is should be more than plenty assistance in working out the code to do it. Ranting at people will not endear anyone to help you.
And yes, I do know the code you need, and its very very simple.
LizR
Posting Virtuoso
1,791 posts since Aug 2008
Reputation Points: 196
Solved Threads: 190
I wasn't talking to you !!
before you talk to people, learn how to respect yourself !
STEP ASIDE !!
I, and everyone else too, realize that programming is often very frustrating. But LizR is just trying to tell you how to do that without actually doing your homework for you. And with that response and attitude you are just chopping off your own arm.
If you have to do the assignment with loops, then look in your textbook about loops. The for loop might be the type you should try. Your text book should should you several examples of loops. Yes, anyone here can tell you about them, but it is better that you look them up yourself so that you learn how to do your own research.
Ancient Dragon
Retired & Loving It
30,049 posts since Aug 2005
Reputation Points: 5,662
Solved Threads: 2,343
>Your post is not going to get you answers
Indeed. mus1010, it's generally wiser to show respect to the people kind enough to reply to you. Keep in mind that in replying, they're showing you a substantial measure of respect simply by not ignoring yet another "I don't know anything, gimme gimme gimme!" thread.
>Why this forum is founded, it looks nobody wants to help.
We prefer to save our help for those willing to work and research our answers rather than expecting the proverbial silver spoon. In my experience, people with your attitude are complete dead weight. They take without giving back, and attack anyone who doesn't bow down before their demands. If you prove that you're willing to put forth some effort, we'll match that with help.
Narue
Bad Cop
15,460 posts since Sep 2004
Reputation Points: 6,464
Solved Threads: 1,401
If you are truely at an end, write down the process on paper, of how you would do it by hand by yourself, write down why you did each thing at each stage and what exactly you did..
heres an example - deliberately not the problem you have:
Such as for a times table..
take a number "n"
1 x n = n
2 x n = n * 2
3 x n = n * 3 ..
12 x n - n * 12
done
Hmm I see a pattern when I do that.
I take a number, I increment it by 1, and multiple n by it.
what does that look like its a loop
so if I have a number from 1 to 12, I multiple it by the number I had..
for counter = 1 to 12
output counter x n = n*counter
Hmm, thats codable..
off you go.
now do the same with your problem
LizR
Posting Virtuoso
1,791 posts since Aug 2008
Reputation Points: 196
Solved Threads: 190