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
How can I invoke another program (a standalone executable, or an operating system command) from within a c program?
What is the difference between strcpy() and memcpy() function in c programming?
Does * p ++ increment p or what it points to?
What are operators in c?
Do you know the difference between malloc() and calloc() function?
What are file streams?
In this assignment you are asked to write a multithreaded program to find the duplicates in an array of 10 million integers. The integers are between -5000,000 to 5000,000 and are generated randomly. Use 10 threads, each thread works on 1000,000 integers. Compare the time needed to accomplish the task with single thread of execution program. Do not include the time to fill the array with integers in the execution time.
Explain how can I open a file so that other programs can update it at the same time?
What is cohesion in c?
the statement while(i) puts the entire logic in loop. this loop is called a) indefinite loop b) definite loop c) loop syntax wrong d) none of the above
Write a program of advanced Fibonacci series.
What is the use of header files?
What does != Mean in c?
a sequence of bytes with one to one corrspondence to those in the external device a) sequential addressing b) address c) byte code d) none
Explain main function in c?