C Program to Print First 10 Even Natural Numbers

In this post, we will learn how to print the first 10 even natural numbers using the C Programming language.

We will print the first 10 even natural numbers using the following methods:

  1. Using For Loop
  2. Using While Loop
  3. Using Do While Loop

So, without further ado, let’s begin this tutorial.

C Program to Print First 10 Even Natural Numbers Using for Loop

// C Program to Print First 10 Even Natural Numbers
#include <stdio.h>
int main(){
    int i;
    
    printf("The First 10 Even Natural Numbers are: \n");
    for (i = 1; i <= 10; i++){
        printf("%d \n", 2 * i);
    }
    return 0;
}

Output

The First 10 Even Natural Numbers are: 
2 
4 
6 
8 
10 
12 
14 
16 
18 
20 

How Does This Program Work ?

    int i;

In this program, we have declared an int data type variable named i.

    for (i = 1; i <= 10; i++){
        printf("%d \n", 2 * i);
    }

Then, we used for loop to print the first 10 even natural numbers. And the result is displayed on the screen using printf() function.

C Program to Print First 10 Even Natural Numbers Using While Loop

// C Program to Print First 10 Even Natural Numbers Using While Loop
#include <stdio.h>
int main(){
    int i = 1;
    
    // Displaying output
    printf("The First 10 Even Natural Numbers are: \n");
    while (i <= 10){
        printf("%d \t", 2 * i);
        i++;
    }
    return 0;
}

Output

The First 10 Even Natural Numbers are: 
2 	4 	6 	8 	10 	12 	14 	16 	18 	20 	

C Program to Print First 10 Even Natural Numbers Using Do While Loop

// C Program to Print First 10 Even Natural Numbers Using Do While Loop
#include <stdio.h>
int main(){
    int i = 1;
    
    // Computing first 10 even natural numbers
    printf("The first 10 even natural numbers are: \n");
    do{
        printf("%d \t", 2 * i);
        ++i;
    }
    while (i <= 10);
    return 0;
}

Output

The first 10 even natural numbers are: 
2 	4 	6 	8 	10 	12 	14 	16 	18 	20 	

Conclusion

I hope after going through this post, you understand how to print the first 10 even natural numbers using C Programming language.

If you have any doubt regarding the program, feel free to contact us in the comment section. We will be delighted to help you.

Also Read:

Leave a Comment

Your email address will not be published. Required fields are marked *