Write a program that asks the user to enter a number n and display the first even numbers. Example: if n=5, the first 5 even numbers are 2, 4, 6, 8 and 10.
(Solution)
#include<stdio.h>
#include<conio.h>
int main( )
{
int ONE, TWO;
printf("Enter Number: ");
scanf("%d",&TWO);
for (ONE=0; ONE<=TWO; ONE+=2)
{
printf ("%d\n",ONE);
}
getch( );
return 0;
}
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment