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
What are the differences between Structures and Arrays?
What does the error message "DGROUP exceeds 64K" mean?
how should functions be apportioned among source files?
How do we print only part of a string in c?
What is structure and union in c?
What are different types of pointers?
Tell us something about keyword 'auto'.
What is sizeof array in c?
WHAT IS THE DEFINATION OF IN TECHNOLOGY AND OFF TECHNOLOGY ?
write an algorithm to display a square matrix.
A character flag or control mechanism that delineates one data item from another a) variable b) constant c) delimiter d) call by reference
When should structures be passed by values or by references?
What is the size of enum in bytes?
Synonymous with pointer array a) character array b) ragged array c) multiple array d) none
Are the outer parentheses in return statements really optional?