Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 8299e50

Browse files
updated readme
1 parent f61060e commit 8299e50

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

‎Basic Questions/q10.c‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
//WAP to find the the product of n natural numbers
2+
13
#include <stdio.h>
24

35
int main() {

‎readme.md‎

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ Make sure to star the repository if you find it useful.
1515
- [7. WAP to display the sum of 'n' terms of 'even' numbers.](#7-wap-to-display-the-sum-of--n--terms-of--even--numbers)
1616
- [8. WAP to check given number is palindrome or not.](#8-wap-to-check-given-number-is-palindrome-or-not)
1717
- [9. WAP to find the factorial of any given number.](#9-wap-to-find-the-factorial-of-any-given-number)
18+
- [10. WAP to find the the product of n natural numbers.](#10-wap-to-find-the-the-product-of-n-natural-numbers)
1819
- [Array Questions](#array-questions)
1920
- [1. WAP to input 10 numbers and display the largest and smallest number.](#1-wap-to-input-10-numbers-and-display-the-largest-and-smallest-number)
2021
- [2. WAP to read the age of 40 students and count the number of students aged between 15 and 22.](#2-wap-to-read-the-age-of-40-students-and-count-the-number-of-students-aged-between-15-and-22)
@@ -143,6 +144,26 @@ If n is a positive integer, the program uses a for loop to calculate the factori
143144

144145
Finally, the program prints the output, which is the value of p.
145146

147+
### 10. WAP to find the the product of n natural numbers.
148+
149+
This is a C program that calculates the product of the first n natural numbers. Here's how it works:
150+
151+
1. The program starts by declaring some variables: n, i, and product.
152+
153+
- n is the number of natural numbers to be multiplied.
154+
- i is a counter variable for the loop that will calculate the product.
155+
- product is the variable that will hold the result of the multiplication.
156+
157+
2. The program prompts the user to enter a positive integer n using the printf and scanf functions.
158+
159+
3. A for loop is used to calculate the product of the first n natural numbers. The loop starts with i = 1 and continues until i <= n.
160+
161+
- Inside the loop, the product is updated by multiplying it with the current value of i.
162+
163+
4. After the loop is complete, the program prints the result using printf.
164+
165+
5. The main function returns 0, indicating successful execution.
166+
146167
## Array Questions
147168

148169
### 1. WAP to input 10 numbers and display the largest and smallest number.

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /