### How to divide the elements of the principal diagonal of a matrix with the elements of the array that are outside I dont have idea how to divide the lements and I dont find any tutorial about it.

the instructions are
2. Write a program that reads the order for a two-dimensional array and contains functions of
user to perform:
a) The reading of data for the arrangement considered.
b) The division of the elements of each row by the corresponding element of the diagonal
major.
c) Printing the resulting array.

this is the stuff that ive made but i dont now how to start de division

#include<iostream>
#include<stdlib.h>

using namespace std;

int main(){

int f,c;
int matriz;

cout<<"Program to find the diagonal of a matrix and divide the digits of said diagonal "<<endl;
cout<<endl;
cout<<"*Remember: The diagonal can only be found in square matrices*"<<endl;
cout<<endl;
cout<<"Enter the rows of your matrix";
cin>>f;
cout<<"Enter the columns of your first matrix ";
cin>>c;

if(f==c){ cout<<"Enter the elements of the array "<<endl;
for( int i=0;i<f;i++){
for(int j=0;j<c;j++){

cout<<"write a number ["<<i<<"]["<<j<<"] ";
cin>> matriz[i][j];

} }

cout<<"the matrix is "<<endl;//imprimir matrices
for(int i=0;i<f;i++){
for(int j=0;j<c;j++){
cout<<matriz[i][j];

}
cout<<"\n";}

cout<<endl;
cout<<"the numbers of the principal diagonal are "<<endl;
for(int i=0; i < f; i++){
for(int j=0; j<c;j++){

if(i==j){
cout<<matriz[i][j];
}

}

cout<<"\n"; }

//dividir los digitos xd

}
else{cout<<"Remember we only cant make the process if it is a square matrix"<<endl;
}

return 0; }

Last edited on Loop through the rows
On each row:
store the diagonal element d;
Loop across the columns doing a /= d

Topic archived. No new replies allowed.