You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: readme.md
+21Lines changed: 21 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -15,6 +15,7 @@ Make sure to star the repository if you find it useful.
15
15
-[7. WAP to display the sum of 'n' terms of 'even' numbers.](#7-wap-to-display-the-sum-of--n--terms-of--even--numbers)
16
16
-[8. WAP to check given number is palindrome or not.](#8-wap-to-check-given-number-is-palindrome-or-not)
17
17
-[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)
18
19
-[Array Questions](#array-questions)
19
20
-[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)
20
21
-[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
143
144
144
145
Finally, the program prints the output, which is the value of p.
145
146
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
+
146
167
## Array Questions
147
168
148
169
### 1. WAP to input 10 numbers and display the largest and smallest number.
0 commit comments