Question

Print Numbers from 1 to 10 using for loop in C Language.

Updated on May 31, 2025 | By Learnzy Admin | 👁️ Views: 443 students

Solution
✔ Verified

This C program demonstrates how to print numbers from 1 to 10 using a for loop.

The for loop is a control flow statement that allows code to be executed repeatedly based on a condition.

 In this program, we initialize a counter variable to 1 and increment it by 1 in each iteration, continuing the loop as long as the counter is less than or equal to 10. During each iteration, the current value of the counter is printed to the console. This is a simple and effective way to understand the basic structure and usage of the for loop in the C programming language.

#include <stdio.h>

int main() {
    for (int i = 1; i <= 10; i++) {
        printf("%d\n", i);
    }
    return 0;
}

Output:--

1  
2  
3  
...  
10

 

Was this solution helpful? 39
Click here to download practice questions on For Loop In C

More Questions on For Loop In C

Question 1

Print the Alphabet (A to Z) using for loop in C Language


View solution
Question 2

Print a Pattern (Right-Angled Triangle) using for loop in C Language


View solution
Question 3

Calculate factorial of a Number (e.g., 5!) using for loop in C language


View solution
Question 4

Calculate sum of First 10 Natural Numbers using for loop in C Language.


View solution
Question 5

Print Table of 5 using for loop in C Language.


View solution
Question 6

Print Even Numbers from 2 to 20 using for loop in C Language.


View solution