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
How can I automatically locate a programs configuration files in the same directory as the executable?
What are multidimensional arrays?
Differentiate call by value and call by reference?
.main() { char *p = "hello world!"; p[0] = 'H'; printf("%s",p); }
illustrate the use of address operator and dereferencing operator with the help of a program guys plzzz help for this question
What is sizeof int in c?
Is null always defined as 0(zero)?
Explain the ternary tree?
Does sprintf put null character?
What is the general form of #line preprocessor?
What is malloc return c?
program to find out date after adding 31 days to a date in the month of febraury also consider the leap year
What is the use of ?
A banker has a seif with a cipher. Not to forget the cipher, he wants to write it coded as following: each digit to be replaced with the difference of 9 with the current digit. The banker chose a cipher. Decipher it knowing the cipher starts with a digit different than 9. I need to write a program that takes the cipher from the keyboard and prints the new cipher. I thought of the following: Take the input from the keyboard and put it into a string or an array. Go through the object with a for and for each digit other than the first, substract it from 9 and add it to another variable. Print the new variable. Theoretically I thought of it but I don't know much C. Could you give me any kind of hint, whether I am on the right track or not?
How can you be sure that a program follows the ANSI C standard?