using Iteration for loop in java what would be the program to run

a) 1!+2!+3!+4!+5!

b) 1/1!+2/2!+3/3!+4/4!+5/5!

c) 1/1!-2/2!+3/3!-4/4!+5/5!

jwenting commented: hopeless homework kiddo -3

Recommended Answers

All 3 Replies

Use recursive funtion (method).

commented: not an answer to the specific question -3

I guess you're very lucky to have gotten that answer since you just pasted your question here

Here is a hint ... the first one in a) , when a number has !, it defines the factorial of a number, for example lets look at 5!
5! = 1*2*3*4*5

so in order to get !1+!2 ..etc , you need to define a method that computes the factorial for any number and then call it for the numbers that you re required such as

result = fact(1) + fact(2) + fact(3)+fact(4)+fact(5);

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.