Wipro: C Program to check if two given matrices are identical ?

Wipro Coding Questions
Wipro Coding Questions

Wipro Coding Questions

C Program to check if two given matrices are identical ?

Explanation:

This C Program checks whether the 2 Matrices are Equal. The program first reads 2 matrices and then checks both the matrices are equal. If both the matrices are equal then display they are equal. If both the matrices are not equal then display they are different.

#include
#define N 4

// This function returns 1 if A[][] and B[][] are identical
// otherwise returns 0
     int areSame(int A[][N], int B[][N])
            {
                  int i, j;
                 for (i = 0; i < N; i++)
                      {

                             for (j = 0; j < N; j++)
                                      {

                                             if (A[i][j] != B[i][j])
                                             return 0;
                                             return 1;
                                      }

                        }

           int main()
               {
                    int A[N][N] = { {1, 1, 1, 1},  {2, 2, 2, 2}, {3, 3, 3, 3}, {4, 4, 4, 4}};

                   int B[N][N] = { {1, 1, 1, 1}, {2, 2, 2, 2}, {3, 3, 3, 3}, {4, 4, 4, 4}};

                       if (areSame(A, B))
                             printf(“Matrices are identical”);
                       else
                           printf(“Matrices are not identical”);
                 return 0;
              }

April Long Challenge 2021 Solutions

Codechef Long Challenge Solutions

February Long Challenge 2021

1. Frog Sort Solution Codechef

2. Chef and Meetings Solution Codechef

3. Maximise Function Solution Codechef

4. Highest Divisor Solution Codechef

5. Cut the Cake Challenge Solution Codechef

6. Dream and the Multiverse Solution Codechef

7. Cell Shell Solution Codechef

8. Multiple Games Solution Codechef

9. Another Tree with Number Theory Solution Codechef

10. XOR Sums Solution Codechef

11. Prime Game Solution CodeChef

12. Team Name Solution Codechef

January Long Challenge 2021

November Challenge 2020 SOLUTION CodeChef

October Lunchtime 2020 CodeChef SOLUTIONS

RELATED :

Related :

Related :

Leave a Comment

close
error: Content is protected !!
Free Udemy Courses and Hacking Resources Join Us on TelegramClick Here
+