Quantcast

A community for students. Sign up today!

Here's the question you clicked on:

55 members online
  • 0 replying
  • 0 viewing

iop360

  • 2 years ago

how to write a factorial in C++

  • This Question is Open
  1. ammar-93
    • 2 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    factorial !! explain more plz !!!

  2. iop360
    • 2 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    3 factorial = 3! = (3*2*1)

  3. iop360
    • 2 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    so say i want \[\frac{ x^3 }{ 3! }\]

  4. iop360
    • 2 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    is there an operator for that

  5. iop360
    • 2 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    or would i just type it out as (3*2*1)

  6. ammar-93
    • 2 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    I got it , I'll explain the algorithm : we can write a loop like this : for i is from x to 1 then : x! = x * (x-1)

  7. iop360
    • 2 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    ok

  8. iop360
    • 2 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    how would i write this

  9. iop360
    • 2 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    most efficiently

  10. ammar-93
    • 2 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    for example .. to calc 5! : for i= 1 to 5 do x!=x(x-1) is it clear ?

  11. iop360
    • 2 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    is that all you would type

  12. iop360
    • 2 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    what does i mean

  13. ammar-93
    • 2 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    I'm sorry I'll not write the code to you , I've told you the idea and U've to try ... good luck

  14. iop360
    • 2 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    ok thanks

  15. eSpeX
    • 2 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    @iop360 Try writing the steps out by hand, then look at the process you used and replicate it in your code.

  16. Not the answer you are looking for?
    Search for more explanations.

    • Attachments:

Ask your own question

Ask a Question
Find more explanations on OpenStudy

Your question is ready. Sign up for free to start getting answers.

spraguer (Moderator)
5 → View Detailed Profile

is replying to Can someone tell me what button the professor is hitting...

23

  • Teamwork 19 Teammate
  • Problem Solving 19 Hero
  • You have blocked this person.
  • ✔ You're a fan Checking fan status...

Thanks for being so helpful in mathematics. If you are getting quality help, make sure you spread the word about OpenStudy.

This is the testimonial you wrote.
You haven't written a testimonial for Owlfred.