In this easy coded program, you will learn how to print even numbers from 1 to 'n' using for loop. Here, 'n' is the number up to which the user wants the even numbers to be printed. --------------------------------------------------------------------------- Program to Print Even Numbers from 1 to n using for Loop /*Even Numbers from 1 to n- for Loop*/ #include<stdio.h> void main () { int i, num; printf( "Enter Number: " ); scanf( "%d" , & num); for (i =2 ; i <= num; i +=2 ) printf( "%d \t " , i); } Output Enter Number : 8 2 4 6 8 --------------------------------------------------------------------------- Hope you found this ' C Program to Print Even Numbers from 1 to n using for...
Start learning C Language in the easiest way with the most easy to understand program codes with tons of examples along with outputs at BEGINC.