Question

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

Updated on May 31, 2025 | By Learnzy Admin | πŸ‘οΈ Views: 316 students

Solution
βœ” Verified

This C program uses a for loop to print all even numbers from 2 to 20. Even numbers are integers that are divisible by 2 without any remainder.

In this program, the for loop starts with the number 2 and increases by 2 in each iteration, continuing until it reaches 20. This approach ensures that only even numbers are printed. The program demonstrates how to use the for loop efficiently for a specific range with a custom increment, making it a great example for understanding loop control in the C language.

#include <stdio.h>

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

Output:--

2
4
6
8
10
12
14
16
18
20

Β 

Was this solution helpful? 49
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 Numbers from 1 to 10 using for loop in C Language.


View solution