write a program to print sum of each row of a 2D array.
Answer Posted / vignesh1988i
first ordinary logic.
LOGIC 1
#include<stdio.h>
#include<conio.h>
void main()
{
int a[50][50],k,row,column;
printf("enter the number of rows and columns of 2D array :");
scanf("%d%d",&row,&column);
for(int i=0;i<row;i++)
{
for(int q=0;q<column;q++)
{
scanf("%d",&a[i][q]);
}
}
for(i=0;i<row;i++)
{
k=0;
for(q=0;q<column;q++)
{
k=k+a[i][q];
}
printf("%d\n",k);
}
getch();
}
| Is This Answer Correct ? | 20 Yes | 32 No |
Post New Answer View All Answers
What is the difference between ++a and a++?
the number of measuring units from a arbitrary starting point in a record area or control block to some other point a) branching b) recording pointer c) none d) offset
7-Given an index k, return the kth row of the Pascal's triangle. For example, when k = 3, the row is [1,3,3,1]. For reference look at the following standard pascal’s triangle.
What is the use of sizeof () in c?
What are the keywords in c?
Explain what is output redirection?
How can you find the day of the week given the date?
What is the symbol indicated the c-preprocessor?
Define Array of pointers.
Explain the properties of union.
What is the general form of function in c?
how do you execute a c program in unix.
Explain what is the use of a semicolon (;) at the end of every program statement?
Give basis knowledge of web designing ...
What is a global variable in c?