Skip to main content

C Program to print the first N even numbers in reverse order.

 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

Popular posts from this blog

C Program to find out the roots of a Quadratic Equation and also test for Real and Complex roots

 C Program to find out the roots of a Quadratic Equation  and also test for Real and Complex roots.       In this example, we will calculate the roots of the quadratic equation by testing for real and complex roots. We can test real and complex roots by checking these conditions : If b 2  −4 ac  < 0, then there are no real roots. If b 2  −4 ac  = 0, then both the roots are equal. If b 2  −4 ac  > 0, then roots are real and distinct.   PROGRAM TO FIND OUT THE ROOTS OF A QUADRATIC EQUATION. #include <stdio.h> #include <conio.h> #include <math.h> int   main () {      int   a , b , c , d ;      float   x , y ;      printf ( "Enter coefficient of x^2,x and constant : " );      scanf ( " %d   %d   %d " ,& a ,& b ,& c );      d = b * b ...

C Program to Check Even or Odd Without Modulous and Bitwise Operator

  C Program to Check Even or Odd Without Modulous and Bitwise Operator                   In this example we will check even or odd without Modulous Operator. To do this program we should know what is even and odd number.                   Even Number: Even numbers are those numbers which are divisible by 2. That means if we divide a number by 2 and if its remainder appears 0 then it is an even number.                                 For Example: 2,4,6,8,10,12,.... are all even numbers.                              ...

C Program to find the sum of the series 1^2+2^2+3^2+…..+n^2

C Program to find the sum of the series  1 2 +2 2 +3 2 +…..+n 2 Enter the end limit at the runtime.       In this example, we calculate the sum of the above mentioned series till the end-limit entered by the user. We have used built-in function pow(x,y) to find the power of the given number.     Here in the output we have entered the value of end-limit as number 7 which gives a sum of 140.    PROGRAM #include <stdio.h> #include <math.h> #include <conio.h> void   main () {      int  n,sum= 0 ,i;      printf ( "Enter the end limit :" );      scanf ( " %d " ,&n);      for (i= 1 ;i<=n;i++)     {         sum=sum+ pow (i, 2 );     }      printf ( "Sum of the series is :  %d " ,sum);  ...

C Program to Generate Multiplication Table according to User Choice.

 C Program to Generate Multiplication Table according to User Choice.     In this program, we will learn how to print a multiplication table according to any positive number entered by the user. This program uses for loop to solve this problem.  C PROGRAM TO GENERATE MULTIPLICATION TABLE: # include < stdio.h > # include < conio.h > int   main () {      int   i , num , res = 0 ;      printf ( "\n Enter the multplication table you want :  " );      scanf ( " %d " ,& num );      printf ( "\n\n\n\t MULTIPLICATION TABLE OF  %d \t" , num );      printf ( "\n -------------------------------------------------- \n" );      for ( i = 1 ; i <= 10 ; i ++)      {          res = num * i ;       ...

C Program to Multiply two Matrices

 C Program to Multiply two Matrices.     In this example, we will calculate the product of the two matrices allowing the user to enter their required number of rows and columns. In matrix multiplication the number of columns, in the first matrix must be equal to the number of  rows in the second matrix, otherwise multiplication is not possible. The product will have the number of rows of the first matrix and the number of columns of the second matrix.     Here in the output we have taken two matrices of order 2x3 and 3x2. The resulting matrix after calculating the product will be of the order 2x2. PROGRAM #include <stdio.h> #include <conio.h> void   main () {      int   row1 , row2 , column1 , column2 , i , j , k ;      int   a [ 10 ][ 10 ], b [ 10 ][ 10 ], mul [ 10 ][ 10 ];      printf ( "Enter the row size of the 1st Matrix :...