#include<stdio.h>
void diagnal(int arr[10][10]);
int main()
{
int arr[10][10],i,j,count=1;
for(i=0;i<10;i++){
for(j=0;j<10;j++){
arr[i][j] = count;
count++;
}
}
for(i=0;i<10;i++){
for(j=0;j<10;j++){
printf("%d\t",arr[i][j]);
}
printf("\n");
}
printf("\n");
diagnal(arr);
return 0;
}
void diagnal(int arr[10][10]){
int i,j;
for(i=0;i<10;i++){
for(j=0;j<10;j++){
if(i==j){
printf("%d\t",arr[i][j]);
}
}
}
}
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter