write a program to print sum of each row of a 2D array.
Answer Posted / khurshid alam
#include<stdio.h>
int main()
{
int a[3][3]={{2,5},{7,8},{1,1}};
int b[3][3]={{5,6},{9,3},{1,1}},i,j,*m,*n,s=0;
n=&a[j][i];
m=&b[j][i];
for(i=0;i<=2;i++)
{
for(j=0;j<=2;j++)
{
s+=a[i][j]+b[i][j];
}
}
printf("Sum :%d",s);
return 0;
}
| Is This Answer Correct ? | 5 Yes | 2 No |
Post New Answer View All Answers
illustrate the use of address operator and dereferencing operator with the help of a program guys plzzz help for this question
What are 'near' and 'far' pointers?
Should a function contain a return statement if it does not return a value?
Why c is faster than c++?
Where static variables are stored in memory in c?
Explain logical errors? Compare with syntax errors.
What is the use of clrscr?
What is difference between class and structure?
What is structure packing in c?
write a program in C that prompts the user for today's date,tomorrow's date and display the results.Use structures for today's date,tomorrow's date and an array to hold the days for each month of the year.
What is %d called in c?
What are the difference between a free-standing and a hosted environment?
What are the different categories of functions in c?
Write a code to generate a series where the next element is the sum of last k terms.
Which is an example of a structural homology?