b) Write a Basic program to print the factorial of any no. The number will be inputted by user. c) Write a Basic program to accept any no and print whether it is positive, negative or Zero.
Answers
Answered by
1
Answer:
The factorial of a number is the product of all the integers from 1 up to that number. The factorial can only be defined for positive integers.
The factorial of a negative number doesn't exist. And the factorial of 0 is 1.
For example,
The factorial of a positive number n, say 5, is denoted by 5! and is given by:
5! = 1 * 2 * 3 * 4 * 5 = 120
So, the Mathematical logic for factorial is:
n! = 1 * 2 * 3 * ... * n
n! = 1 if n = 0 or n = 1
In this program below, the user is asked to enter a positive integer. Then the factorial of that number is computed and displayed on the screen.
Similar questions