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

Explain what are multidimensional arrays?

596


Is there any demerits of using pointer?

621


What is the meaning of typedef struct in c?

584


What is data types?

632


how logic is used

1493






What does s c mean on snapchat?

579


What is #line in c?

556


What is quick sort in c?

577


What are register variables in c?

571


How to implement a packet in C

2387


Describe the difference between = and == symbols in c programming?

769


Explain the array representation of a binary tree in C.

722


What is meant by type specifiers?

655


Is there a way to have non-constant case labels (i.e. Ranges or arbitrary expressions)?

574


Where in memory are my variables stored?

629