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
Why static variable is used in c?
Add Two Numbers Without Using the Addition Operator
write a program in c language to print your bio-data on the screen by using functions.
What are the types of pointers in c?
What is array of pointers to string?
Input is "rama loves rajesh and rajesh Loves rama also and rajesh wear gloves and bloves" To print output is count the numbers of times repeted the word love without case sensitive.
How many main () function we can have in a project?
Why can arithmetic operations not be performed on void pointers?
What is volatile variable in c with example?
What is function prototype in c with example?
Why main is used in c?
Explain that why C is procedural?
What is meant by int main ()?
Is int a keyword in c?
What are the difference between a free-standing and a hosted environment?