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 data structures in c and how to use them?
Calculate the weighted average of a list of n numbers using the formula xavg = f1x1+f2x2+ ….+ fnxn where the f’s are fractional weighting factors, i.e., 0<=fi<1, and f1+f2+….+fn = 1
What are compound statements?
Is c still used?
what is different between auto and local static? why should we use local static?
If a five digit number is input through the keyboard, write a program to print a new number by adding one to each of its digits.For example if the number that is input is 12391 then the output should be displayed as 23402
Explain why C language is procedural?
write a program to display all prime numbers
What is the difference between abs() and fabs() functions?
What is keyword in c?
Can the sizeof operator be used to tell the size of an array passed to a function?
What are the types of functions in c?
What is New modifiers?
Explain what is a program flowchart and explain how does it help in writing a program?
What is the difference between array and pointer in c?