Print Natural Numbers from 1 to 100 in C
Here, in this blog post, I have shared code for natural numbers from 1 to 100 in C Programming Language.
#include <stdio.h>
int main() {
int i;
for(i = 1; i <= 100; i++) {
printf("%d ", i);
}
return 0;
}
Explanation:
- The for loop iterates from 1 to 100 using the loop variable i.
- The loop body contains a printf statement that prints the value of i followed by a space.
- The loop ends when i becomes greater than 100.
- The program returns 0 to indicate successful execution.