C++ program to find the principal diagonal elements in a array
Answers
Answered by
1
#include<iostream.h>
void main()
{
int a[10][10],d[10];
int b,c;
cout<<"enter the values to the array";
for(b=0;b<1 0;b++)
{
for(c=0;c<10:c++)
{cin>>a[b][c];}
}
cout<<"FINDING DIAGONAL ELEMENTS.................";
for(b=0;b<10;b++)
{
d[b]=a[b][b];
}
cout<<"ELEMENTS FOUND PRINTING...........";
for(c=0;c<10;c++)
{
cout<<d[c];
}
}
void main()
{
int a[10][10],d[10];
int b,c;
cout<<"enter the values to the array";
for(b=0;b<1 0;b++)
{
for(c=0;c<10:c++)
{cin>>a[b][c];}
}
cout<<"FINDING DIAGONAL ELEMENTS.................";
for(b=0;b<10;b++)
{
d[b]=a[b][b];
}
cout<<"ELEMENTS FOUND PRINTING...........";
for(c=0;c<10;c++)
{
cout<<d[c];
}
}
Similar questions