Question

Print Numbers from 1 to 10 using while loop in C Language

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

Solution
✔ Verified

This C program demonstrates how to use a while loop to print numbers from 1 to 10.

 The while loop is an entry-controlled loop, meaning the condition is checked before the loop body is executed. The program initializes a counter variable and increments it in each iteration until it reaches 10, printing the value during each loop cycle.

#include <stdio.h>

int main() {
    int i = 1;

    while(i <= 10) {
        printf("%d\n", i);
        i++;
    }

    return 0;
}

Output:-

1
2
3
4
5
6
7
8
9
10

 

 

Was this solution helpful? 27
Click here to download practice questions on While loop in C

More Questions on While loop in C

Question 1

Sum of First N Natural Numbers using while loop in C Language


View solution