UrbanPro

Learn C Language from the Best Tutors

  • Affordable fees
  • 1-1 or Group class
  • Flexible Timings
  • Verified Tutors

Search in

How do I rotate a matrix by 180 degrees in C?

Asked by Last Modified  

Follow 2
Answer

Please enter your answer

Trainer

// C program to rotate a matrix by 180 degrees #include <stdio.h> #define N 3 // Function to Rotate the matrix by 180 degree void rotateMatrix(int mat) { // Simply print from last cell to first cell. for (int i = N - 1; i >= 0; i--) { for (int j = N - 1; j >= 0; j--) printf("%d ", mat); printf("\n");...
read more

// C program to rotate a matrix by 180 degrees
#include <stdio.h>
#define N 3

// Function to Rotate the matrix by 180 degree
void rotateMatrix(int mat[][N])
{
// Simply print from last cell to first cell.
for (int i = N - 1; i >= 0; i--) {
for (int j = N - 1; j >= 0; j--)
printf("%d ", mat[i][j]);

printf("\n");
}
}

// Driven code
int main()
{
int mat[N][N] = {
{ 1, 2, 3 },
{ 4, 5, 6 },
{ 7, 8, 9 }
};

rotateMatrix(mat);
return 0;
}

read less
Comments

Tutor

better approach would be with MATLAB TOOL NOT CSHAP COMPILER
Comments

Related Questions

Which is the best C language IDE/compiler for Windows?
Let us now check out some of the famous and best-working IDEs available. Visual Studio Code. Visual Studio Code is one of the most popular IDEs and is open-source software developed by Microsoft....
Deepashri
0 0
5
Do every operator has an Associativity?
Yes, every operator will have an associativity.
Basundhara
0 0
5

What is void main () into main and what it does?

Void main () is the entry point for execution in C program. The void is a keyword that represents function will not return anything but a void value. Main is the name of the function and () represents...
Noreen
In C/C++, when should you use the comma (,) operator instead of the semicolon (;) statement terminator?
int a=2; b=a; b=a+2; Instead of the above two statements we can write it as b=(a,a+2); The value of b is 4
Thimma
0 0
5
Give the structure of 'C' programming. Also, give significance of math.h and string.h header files.
Hi, C structure is procedural programming. math.h and string .h will have a declerations of predefined methods. math.h ex: sqrt(),...etc. string.h ex: strlen(),strcpy,...etc. if you wanna brif let meknow. Thanks.
Ishwari

Now ask question in any of the 1000+ Categories, and get Answers from Tutors and Trainers on UrbanPro.com

Ask a Question

Related Lessons

Basics Of C And C++
C++ is powerful, highly flexible, and adaptable programming language that allows software engineers to organise and process information quickly and effectively. But this high-level language is relatively...

Memory Layout of C Programs
A typical memory representation of C program consists of following sections. Text Segment: A text segment, also known as a code segment or simply as text, is one of the sections of a program in an object...

Structures in C
A structure is a collection of one or more data members possibly of different data types, grouped together under a single name for convenient handling. Defining a Structure: In general terms,...

Some interview questions and answers for fresher level on Pointers
What is a void pointer? Void pointer is a special type of pointer which can reference or point to any data type. This is why it is also called as Generic Pointer. As a void pointer can point to...

Pointers Concept
Every variable has a memory location and every memory location has its address defined which can be accessed using ampersand (&) operator, which denotes an address in memory. Consider the following...

Recommended Articles

Lasya Infotech is a Hyderabad based IT training institute founded in 2016 by O Venkat. Believing in his innovation, passion and persistence and with a diverse blend of experience, he started his brainchild to deliver exemplary professional courses to aspiring candidates by honing their skills. Ever since the institute envisions...

Read full article >

Brilliant Academy is one of the reputed institutes for B.Tech tuition classes. This institute is specialised in delivering quality tuition classes for B.E, Engineering - all streams and Engineering diploma courses. Incorporated in 2012, Brillant Academy is a brainchild of Mr Jagadeesh. The main motto of the academy is to...

Read full article >

Information technology consultancy or Information technology consulting is a specialized field in which one can set their focus on providing advisory services to business firms on finding ways to use innovations in information technology to further their business and meet the objectives of the business. Not only does...

Read full article >

Whether it was the Internet Era of 90s or the Big Data Era of today, Information Technology (IT) has given birth to several lucrative career options for many. Though there will not be a “significant" increase in demand for IT professionals in 2014 as compared to 2013, a “steady” demand for IT professionals is rest assured...

Read full article >

Looking for C Language Classes?

Learn from the Best Tutors on UrbanPro

Are you a Tutor or Training Institute?

Join UrbanPro Today to find students near you
X

Looking for C Language Classes?

The best tutors for C Language Classes are on UrbanPro

  • Select the best Tutor
  • Book & Attend a Free Demo
  • Pay and start Learning

Learn C Language with the Best Tutors

The best Tutors for C Language Classes are on UrbanPro

This website uses cookies

We use cookies to improve user experience. Choose what cookies you allow us to use. You can read more about our Cookie Policy in our Privacy Policy

Accept All
Decline All

UrbanPro.com is India's largest network of most trusted tutors and institutes. Over 55 lakh students rely on UrbanPro.com, to fulfill their learning requirements across 1,000+ categories. Using UrbanPro.com, parents, and students can compare multiple Tutors and Institutes and choose the one that best suits their requirements. More than 7.5 lakh verified Tutors and Institutes are helping millions of students every day and growing their tutoring business on UrbanPro.com. Whether you are looking for a tutor to learn mathematics, a German language trainer to brush up your German language skills or an institute to upgrade your IT skills, we have got the best selection of Tutors and Training Institutes for you. Read more