. 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].
Answer Posted / 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 View All Answers
Create a program to read two random data set in two files named data1.txt and data2.txt manifold contains integer numbers, whereas data2.txt file contains the float type numbers. Simpanlahmasing each into 2 pieces of data that is an array of type integer array and an array of type float, then calculate the average numbers in the second array.
Code for Easily Using Hash Table?
Teta-Omeg-Big-Oh Show that f(n) = n2 + 3n3 is ;(n3).
can you please write a program for deadlock that can detect deadlock and to prevent deadlock.
find level of following tree (state, parent) " J,D I,D H,C E,B F,B G,C B,A D,A C,A A,& K,E L,E L,F M,F N,G O,H P,I P,H Q,I R,J S,K U,P T,L
1+1/2!+1/3!+...+1/n!
create a stucture student containing field for roll no,class,year and marks.create 10 student annd store them in a file
Given a table of the form: Product Sold on A 1/1/1980 B 1/1/1980 C 1/1/1980 A 1/1/1980 B 1/1/1980 C 2/1/1980 A 2/1/1980 There are 30 products and 10,000 records of such type. Also the month period during which sales happened is given to u. Write the program to display the result as: Product Month No. of copies A January 12 A February 15 A March 27 B January 54 B February 15 B March 10 C January 37
output for printf("printf");
How can I Draw an ellipse in 3d space and color it by using graph3d?
What output does the following code generate? Why? What output does it generate if you make A::Foo() a pure virtual function? class A { A() { this->Foo(); } virtual void Foo() { cout << "A::Foo()" << endl; } }; class B : public A { B() { this->Foo(); } virtual void Foo() { cout << "A::Foo()" << endl; } }; int main(int, char**) { A objectA; B objectB; return 0; }
write a program that prompt the user to enter his height and weight,then calculate the body mass index and show the algorithm used
Write a C/C++ program that connects to a MySQL server and checks if the InnoDB plug-in is installed on it. If so, your program should print the total number of disk writes by MySQL.
How to Split Strings with Regex in Managed C++ Applications?
Write a C++ program without using any loop (if, for, while etc) to print prime numbers from 1 to 100 and 100 to 1 (Do not use 200 print statements!!!)