Wrtie a program with it's output
Answers
Answer:
okay lets start with hellow worlld basic program to start with .
Explanation:
#include <stdio.h>
int main() {
// printf() displays the string inside quotation
printf("Hello, World!");
return 0;
}
output= Hello,World!
Python Programming of Factorial
Output:
The factorial of 7 is 5040
Explanation:
#declare the variable and initialize to 7
n = 7
#declare the variable and initialize to 1
fact = 1
# check the n is negative, positive or zero
if(n < 0):
print("The factorial does not exist for negative numbers")
# check the n is equal to zero
elif(n == 0):
print("The factorial of 0 is 1")
else:
for i in range(1,n + 1):
fact = fact*i
print("The factorial of",n,"is",fact)
The following are the description of the program.
- Declare two variables 'n' and 'fact' and initialize them to 7, 1.
- Then, set the if conditional statement that check the variable n is smaller than 0 or not then, print the following message.
- Then, check the variable 'n' is equal to 0 then, print the following message.
- Otherwise, set the for loop that multiply the variable 'fact' to the variable 'i' at n times and store it in the variable 'fact' .
Learn More:
https://brainly.in/question/14887111