C Program to Print First 10 Even Natural Numbers

Write a C program to print first 10 even natural numbers using for loop.

#include <stdio.h>

int main()
{
	printf("The First 10 Even Natural Numbers are\n");
	for (int i = 1; i <= 10; i++)
	{
		printf("%d\n", 2 * i);
	}
}
C Program to Print First 10 Even Natural Numbers

This C program displays the first 10 even natural numbers using a while loop.

#include <stdio.h>

int main()
{
	printf("The First 10 Even Natural Numbers are\n");

	int i = 1;

	while (i <= 10)
	{
		printf("%d\n", 2 * i);
		i++;
	}
}
The First 10 Even Natural Numbers are
2
4
6
8
10
12
14
16
18
20

This C program uses the do while loop to print the first 10 even natural numbers.

#include <stdio.h>

int main()
{

	printf("The First 10 Even Natural Numbers are\n");

	int i = 1;

	do
	{
		printf("%d\n", 2 * i);

	} while (++i <= 10);
}
The First 10 Even Natural Numbers are
2
4
6
8
10
12
14
16
18
20

About Suresh

Suresh is the founder of TutorialGateway and a freelance software developer. He specialized in Designing and Developing Windows and Web applications. The experience he gained in Programming and BI integration, and reporting tools translates into this blog. You can find him on Facebook or Twitter.