CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 15 of 16

Threaded View

  1. #1
    Join Date
    Apr 2005
    Posts
    38

    could you check this code?

    Hi guys and girls

    I've got another problem... I've coded the solution for this question but it's not working and i can't figure out why. Can you guys help me? Thanks if you can...

    *****************************************************************
    A factorial number is a number multiplied by every factor between 1 and the number, inclusive. For instance, 3 factorial is 3 * 2 * 1, which is equal to 6. Mathematically, the factorial function is denoted using an exclamation mark (!).

    A negative factorial number is undefined. Your task is as follows. Design a C++ program that prompts the user to enter a positive integer number. Use a for loop to calculate the factorial value of that number. If the user enters a negative number, display a message indicating that the program calculates only factorials of positive numbers. Otherwise, display the result of the calculation.

    You must define at least one function called:

    factorial(x)

    where this function will return an integer as the result of the computation of x!. Hence, calling this function with factorial(3) will return 6.

    Attached is what i coded
    Attached Files Attached Files

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured