Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

write a program to print sum of each row of a 2D array.

Answer Posted / poornima

int b[20];
int main()
{
int a[20][20],row,col,i,j;
printf("Row & col : ");
scanf("%d %d",&row,&col);
printf("\nEnter elements : ");
for(i=0;i<row;i++)
{
for(j=0;j<col;j++)
{
scanf("%d",&a[i][j]);
}
}
printf("\nElements are\n");
for(i=0;i<row;i++)
{
for(j=0;j<col;j++)
{
printf("%d\t",a[i][j]);
}
printf("\n");
}

for(i=0;i<row;i++)
{
for(j=0;j<col;j++)
{
b[i] +=a[i][j];
}
}
for(i=0;i<row;i++)
{
printf("Sum of row %d is %d\n",(i+1),b[i]);
}
return 0;
}

Is This Answer Correct ?    43 Yes 35 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Why doesnt long int work?

976


Write a program to know whether the input number is an armstrong number.

1072


What standard functions are available to manipulate strings?

1074


What is function and its example?

1109


Write a program to check whether a number is prime or not using c?

1008


How many keywords (reserve words) are in c?

1083


int i[2], j; int *pi;i[0] = 1; i[1] = 5; pi = i; j = *pi + 1 + *(pi + 1)Value of j after execution of the above statements will be a) 7 b) 6 c) 4 d) pointer

989


What are the salient features of c languages?

1043


Hi can anyone tell what is a start up code?

1999


What does d mean?

1016


a character or group of characters that defines a register,or a part of storage a) memory b) byte c) address d) linear list

960


Explain what is the best way to comment out a section of code that contains comments?

1091


write a program to print the consecutive repeated character from the given string... input string is : hhhhjkutskkkkkggggj output should be like this: hhhhkkkkkgggg anyone help me...

1879


write a c program to calculate sum of digits till it reduces to a single digit using recursion

3244


what are the program that using a two dimensional array that list the odd numbers and even numbers separately in a given 10 inputs values

1645