C Program to Print Mirror Image of Matrix

In this example, You learn about c program for mirror image of matrix. 

Here you learn mirror image of matrix in C, You are given a matrix of N*N and the task of the program to find mirror image of matrix.

C Program to Print Mirror Image of Matrix

#include<stdio.h>
int main()
{
    int r,i,j;
    printf("Enter number of rows:");
    scanf("%d",&r);
    int a[r][r];
    printf("Enter %d matrix elements:\n",r*r);
    for(i=0;i<r;i++)
    {
        for(j=0;j<r;j++)
        scanf("%d",&a[i][j]);
    }
    printf("Matrix Elements:\n");
    for(i=0;i<r;i++)
    {
        printf("\n");
        for(j=0;j<r;j++)
        {
            printf("%d\t",a[i][j]);
        }
    
    }
    printf("\nMirror Image of Matrix:\n");
    for(i=0;i<r;i++)
    {
        printf("\n");
        for(j=r-1;j>=0;j--)
        {
            printf("%d\t",a[i][j]);
        }
    
    }
    return 0;
}
Output

 Enter Number of rows and cols:3

 Matrix Elements:

 3   8   4   
 7   9   2   
 7   5   1
    
 Mirror Image of Matrix:

 4   8   3   
 2   9   7   
 1   5   7   

1 Comments

If you have any doubts, Please let me know

  1. Although casinos 룰렛 could earn some money from meals, entertainment, and different venues, the breadwinner for the trade is the games. A good portion of casino earnings are end result of|the results of} the accrual of all of the losses from casino patrons annually. The house benefit clearly isn’t insurmountable—people do win . However, it does mean that the more you play, the more the math works in opposition to you, and the better the possibilities are of you walking out of the casino with much less money in your wallet than when you came in.

    ReplyDelete
Previous Post Next Post

Contact Form