Want this question answered?

Be notified when an answer is posted

Add your answer:

Earn +20 pts
Q: Output of a c program using function to find factorial of a number?
Write your answer...
Still have questions?
magnify glass
Related questions

Write a recursive procedure to compute the factorial of a number?

#include <iostream> using namespace std; int main() { int i, number=0, factorial=1; // User input must be an integer number between 1 and 10 while(number<1 number>10) { cout << "Enter integer number (1-10) = "; cin >> number; } // Calculate the factorial with a FOR loop for(i=1; i<=number; i++) { factorial = factorial*i; } // Output result cout << "Factorial = " << factorial << endl;

What is the rule to determine how to get the output number from the input number?

The rule that determines the output number based on the input number is known as a function. For example take the function: f(x) = x+1. F is the name of our function, x is the input number, and f(x) is our output number. So if our input number is 3, our function or "rule" says to add one to it. Therefore, f(x), known as the output number, would be 4 since 3+1 = 4.

How do you create a program that will display output?

It must use a function with a "return" statement. Or you could output via console. (.NET CODE(C#)) Console.WriteLine("Output.");

If you quadruple the input of a function and the resulting output is one-fourth the original output what may be true of the function?

More input results in less output. The function is inversely proportional.

Abap Program To find Factorial of number?

report zbharath. data:num type i value 5, fac type i value 0. perform fact using num changing fac. write:/ 'factorial of',num,'is',fac. form fact. using value(f-num) type i. changing f-fact type i. f-fact=1. while f-num ge 1. f-fact=f-fact*f-num. f-num=f-num-1. endwhile. endform.

What number will the function return if the input is 12.2?


Why wont your c plus plus program stay open?

If you are talking about the program executing, but the output screen being displayed for a flash and then disappearing, I suggest adding getch() or getchar() function at the end of your main function. This will make sure that the output screen waits for you to press a character before the program terminates.

How do you find the minimum and the maximum of a function?

'*** PROGRAM: Compare 2 numbers using both min/max functions; ' then, output which number is max/and, which is min. '*** declare variables... min = 0 max = 0 number1 = 342 number2 = 256 '*** main program... CLS '...(CL)ear the Output (S)creen PRINT "Minimum = "; findMin(number1, number2) PRINT "Maximum = "; findMax(number1, number2) END '...END of program/halt program code execution FUNCTION findMax (num1, num2) answer = 0 IF num1 > num2 THEN answer = num1 ELSE answer = num2 findMax = answer END FUNCTION FUNCTION findMin (num1, num2) answer = 0 IF num1 < num2 THEN answer = num1 ELSE answer = num2 findMin = answer END FUNCTION ---program output... Minimum: 256 Maximum: 342

What is the domain of a discrete function?

The domain is the possible values that can be input into the function and produce a real number output.

How do you write a full program to find factors of given number in UNIX shell programming?

echo "Enter a number: " read num i=2 res=1 if [ $num -ge 2 ] then while [ $i -le $num ] do res=`expr $res \* $i` i=`expr $i + 1` done fi echo "Factorial of $num = $res" v

What mathematical program can solve the highest number puzzle?

Any program whose output is: " Don't waste your time! There is no highest number. Never was, never will be."

What is the collection of all output values called?

All the output values of a function are collectively called the "range" of that function. For example, consider the function x2. Any number squared will give a positive. Thus, the "range" of the function is positive numbers.