C Program to print the first N even numbers in reverse order.
In this example, we will print the first N even numbers in reverse order. Here N is the total number of even numbers you want to print.
PROGRAM TO PRINT THE FIRST N EVEN NUMBERS IN REVERSE ORDER:
#include<stdio.h>
#include<conio.h>
int main()
{
int even,n,i;
printf("Enter the value of N : ");
scanf("%d",&n);
printf("Printing first %d even numbers in reverse order : ",n);
for(i=n*2;i>2;i--)
{
if(i%2==0)
{
printf("%d\t",i);
}
}
return 0;
}
OUTPUT TO PRINT THE FIRST N EVEN NATURAL NUMBERS IN REVERSE ORDER:
Enter the value of N : 10
Printing first 10 even numbers in reverse order : 20 18 16 14 12 10 8 6 4
NOTE: You Can Comment Your Code if you have solved differently and we will pin it in the comment section. Let's Learn together.
MOTTO:
You Learn, I Learn together We Learn.
Comments
Post a Comment
Please do not spam any link