Skip to content
Merged

ok #2

Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions Basic Questions/q10.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#include <stdio.h>

int main() {
int n, i;
int product = 1;

printf("Enter a positive integer n: ");
scanf("%d", &n);

for (i = 1; i <= n; ++i) {
product *= i;
}

printf("The product of the first %d natural numbers is %d.", n, product);

return 0;
}