Anouncement

C program to print even numbers starting from 1 to n

 C Program

  • Write a C Program to Print Even Numbers Starting From 1 to N.

Program

#include <stdio.h>
int main() {
	int n,i;
	printf("Enter Number:");
	scanf("%d", &n);
	//Loop using 
	for (i =1; i<=n; i++) {
		if (i%2==0) {
			printf("%d\n",i );
		}
	}
	return 0;
}
Output: Enter Number: 10
2
4
6
8
10

Algorithm

  1. Start.
  2. Declare Integer "n,i"
  3. Read "n"
  4. For loop (i=1;i<=n;i++)
  5. if condition (i%2==0)
  6. Print Even Numbers
  7. Stop.

FlowChart


Article bottom Ads

Central Ads Article 1

Middle Ads Article 2

Article Bottom Ads