. Write a program using two-dimensional arrays that computes
the sum of data in tows and the sum of data in columns of
the 3x3 (three by three) array variable n[3][3].

Answers were Sorted based on User's Feedback



. Write a program using two-dimensional arrays that computes the sum of data in tows and the sum of..

Answer / sreejesh1987

#include<stdio.h>
#include<conio.h>
void main()
{
int i,j,a[3][3],rowsum[3],colsum[3];
clrscr();

for(i=0;i<3;i++)
rowsum[i]=colsum[i]=0;

printf("Enter numbers:\n");
for(i=0;i<3;i++)
for(j=0;j<3;j++)
{
scanf("%d",&a[i][j]);
rowsum[i]+=a[i][j];
colsum[j]+=a[i][j];
}


for(i=0;i<3;i++)
printf("RowSum[%d]:%d\n",i,rowsum[i]);

for(i=0;i<3;i++)
printf("Columnsum[%d]:%d\n",i,colsum[i]);

getch();
}

Is This Answer Correct ?    28 Yes 17 No

. Write a program using two-dimensional arrays that computes the sum of data in tows and the sum of..

Answer / rowel baldemoro

#include<stdio.h>
#include <conio.h>
#include <windows.h>
#include <iostream>

using namespace std;
void design(int x, int y){

COORD coord;
coord.X=x;
coord.Y=y;
SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE),coord);


}
int main()
{

int no[3][3],sum[2][3];

//1x3
design(1,0);
cin>>no[0][0];

design(4,0);
cin>>no[0][1];

design(7,0);
cin>>no[0][2];
sum[0][0]=no[0][0]+no[0][1]+no[0][2];

design(8,0);
printf("=%d",sum[0][0]);
//2x3
design(1,2);
cin>>no[1][0];

design(4,2);
cin>>no[1][1];

design(7,2);
cin>>no[1][2];
sum[0][1]=no[1][0]+no[1][1]+no[1][2];

design(8,2);
printf("=%d",sum[0][1]);
//3x3
design(1,4);
cin>>no[2][0];

design(4,4);
cin>>no[2][1];

design(7,4);
cin>>no[2][2];
sum[0][2]=no[2][0]+no[2][1]+no[2][2];

design(8,4);
printf("=%d",sum[0][2]);

sum[1][0]=0;
for(int i=0;i<3;i++){
design(1,6);

sum[1][0]=sum[1][0]+no[i][0];
cout<<sum[1][0];
}
design(4,6);


design(7,6);

getch();
}

Is This Answer Correct ?    10 Yes 4 No

Post New Answer

More C++ Code Interview Questions

A suduco given & u hv 2 check if it is incomplete(blanks left),or correct or incorrect

0 Answers  


solve the problem in the programming language C++"if a five digit number is input through the keyboard.Write a program to calculate the sum of its digits(hint: use the modulus operator)

0 Answers  


write a proram using exceptional handling create a error & display the message "THERE IS AN ERROR?... PLEASE RECTIFY"?

1 Answers  


write a program that calculate the volume of cylinder after user enters radius and height and show the algorithm used

1 Answers   Jomo Kenyatta University,


Given 1 to n distinct random number of which n+1th element was duplicated. How do find the duplicate element and explain the time complexity of the algorithm.

0 Answers   Microsoft, NetApp,






main(){int a=5,b 10,c=2, d;a=b c;d=++a=(--c)*2; printf("%d%d%d%d,a,b,c,d; return o;}

1 Answers  


Show by induction that 2n > n2, for all n > 4.

2 Answers   Karvy, Qatar University,


write a program in c++ to scramble a bmp image file using a scramble key 0x7c and an XOR logic. print out the original image, the scrambled image and the program. Note: the first 24bytes of a bmp file contain the header information of the file.

1 Answers  


Counting in Lojban, an artificial language developed over the last fourty years, is easier than in most languages The numbers from zero to nine are: 0 no 1 pa 2 re 3 ci 4 vo 5 mk 6 xa 7 ze 8 bi 9 so Larger numbers are created by gluing the digit togather. For Examle 123 is pareci Write a program that reads in a lojban string(representing a no less than or equal to 1,000,000) and output it in numbers.

4 Answers  


3. Program to find the Sum of give series. a. (1)+(1+2)+(1+2+3)+(1+2+3+4)+……………………………….. b. 1/1+1/9+1/25+1/49+……………...

0 Answers  


A Binary no. is given, we hav to find it's decimal equivalent.

2 Answers   Microsoft,


How reader and writer problem was implemented and come up with effective solution for reader and writer problem in case we have n readers and 1 writer.

6 Answers   Microsoft, NetApp,


Categories