Loops
Print 1 to N
Print numbers from 1 to N using a for loop.
Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
Print numbers from 1 to N using a for loop.
#include <stdio.h>
int main() {
int n;
scanf("%d", &n);
for (int i = 1; i <= n; i++) {
printf("%d\n", i);
}
return 0;
}
5
1
2
3
4
5