Horje
identity Code Example
identity
#include<iostream>
using namespace std;

int main()
{
	int i, j, rows, columns, flag = 1;
	
	cout << "\nPlease Enter Matrix rows and Columns to find Identity Matrix =  ";
	cin >> i >> j;
	
	int identMatrix[i][j];
	
	cout << "\nPlease Enter the Identity Matrix Items\n";
	for(rows = 0; rows < i; rows++)	{
		for(columns = 0; columns < i; columns++) {
			cin >> identMatrix[rows][columns];
		}		
	}

 	for(rows = 0; rows < i; rows++)
  	{
   		for(columns = 0; columns < j; columns++)
    	{
    		if(identMatrix[rows][columns] != 1 && identMatrix[columns][rows] != 0)
    		{
    			flag = 0;
    			break;
			}
   	 	}
  	}
  	if(flag == 1)
  	{
  		cout << "\nThe Matrix that you entered is an Identity Matrix";
	}
	else
	{
		cout << "\nThe Matrix that you entered is Not an Identity Matrix";
	}  	

 	return 0;
}




Cpp

Related
robux 1M Code Example robux 1M Code Example
onclick show hide div jquery demo Code Example onclick show hide div jquery demo Code Example
sort vector from smallest to largest Code Example sort vector from smallest to largest Code Example
C if Code Example C if Code Example
warning: base will be initialized after Code Example warning: base will be initialized after Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
11