. 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

Write a program using one dimensional array that accept five values from the keyboard. Then it should also accept a number to search. This number is to be searched if it among the five input values. If it is found, display the message “Search number is found!” otherwise, display “Search is lost”. Example: Enter 5 numbers: 10 15 20 7 8 Enter number to search: 7 Search number is found!

2 Answers   College School Exams Tests,


1. Write a program using one dimensional array that calculates the sum and average of the five input values from the keyboard and prints the calculated sum and average.

2 Answers  


Write a function- oriented to convert the input dollar(s) into its equivalent peso. Assume that one dollar is equivalent to 51.60

1 Answers  


Write a program using one dimensional array that searches a number and display the number of times it occurs on the list of 12 input values. Sample input/output dialogue: Enter 12 values: 13 15 20 13 30 35 40 16 18 20 18 20 Enter number to search: 20 Occurences: 3

2 Answers  


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  






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,


write a program that accepts a number and outputs its equivalent in words. take note that the maximum input is 3000

1 Answers   Alvin,


How to swap two ASCII numbers?

0 Answers  


Faster Computers Suppose you have a computer that requires 1 minute to solve problem instances of size 1000. What instance sizes can be run in 1 minute if you buy a new computer that runs 1000 times faster than the old one, assuming the following time complexities T(n) for our algorithm? (a) T(n) = O(n). (b) T(n) = O(n3). (c) T(n) = O(10n).

1 Answers   Qatar University,


i really need help about this.. write a program to display the set of odd and even numbers separately. find the highest and lowest value of the given numbers.

0 Answers  


Min-Max Write an algorithm that finds both the smallest and largest numbers in a list of n numbers and calculate its complexity T(n).

1 Answers   Infosys, Qatar University,


#include<iostream.h> //main() //{ class A { friend class B; public: void read(); }; class B { public : int a,b; }; void A::read() { cout<<"welcome"; } main() { A x; B y; y.read(); } In the above program......, as B is a friend of A B can have access to all members,i cant access y.read . could you please tell me the reason and what would i code to execute this program?

2 Answers  


Categories