Write a C program that defines a 2-dimentional integer array
called A [50][50]. Then the elements of this array should
randomly be initialized either to 1 or 0. The program should
then print out all the elements in the diagonal (i.e.
a[0][0], a[1][1],a[2][2], a[3][3], ……..a[49][49]). Finally,
print out how many zeros and ones in the diagonal.

Answer Posted / pushpender singh

#include<stdio.h>

main
{
int a,b,c;
a[50][50];
b[][];
for(c=0;c>50;c+a)
{
a=a+c;
b=a;
}
printf("%d",b[][]);
}
}

Is This Answer Correct ?    0 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are the differences between Structures and Arrays?

614


What does the error message "DGROUP exceeds 64K" mean?

729


how should functions be apportioned among source files?

627


How do we print only part of a string in c?

587


What is structure and union in c?

605






What are different types of pointers?

566


Tell us something about keyword 'auto'.

668


What is sizeof array in c?

597


WHAT IS THE DEFINATION OF IN TECHNOLOGY AND OFF TECHNOLOGY ?

1862


write an algorithm to display a square matrix.

2226


A character flag or control mechanism that delineates one data item from another a) variable b) constant c) delimiter d) call by reference

637


When should structures be passed by values or by references?

588


What is the size of enum in bytes?

592


Synonymous with pointer array a) character array b) ragged array c) multiple array d) none

620


Are the outer parentheses in return statements really optional?

580