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
246810
Algorithm
- Start.
- Declare Integer "n,i"
- Read "n"
- For loop (i=1;i<=n;i++)
- if condition (i%2==0)
- Print Even Numbers
- Stop.
FlowChart
Genrerating Link.... 15 seconds.
Your Link is Ready.