Write a CC program uses nested for loops to take input value
Solution
#include <iostream>
#include <fstream>
#include <iomanip>
#include <cmath>
#include <algorithm>
using namespace std;
#define x 0.0174
int main(){
const int N = 2;
const int M = 2;
double VOLTS[N][M];
double CURRENT[N][M];
double PHASE[N][M];
double WATTS[N][M];
double VARS[N][M];
double BILLS[N][M];
//take in input volts
cout << \"Enter \" << N*M << \" values of VOLTS: \"<< endl;
for(int i = 0; i < N; i++){
for(int j = 0; j < M; j++){
cin >> VOLTS[i][j];
}}
//take in input current
cout << \"Enter \" << N*M << \" values of CURRENT: \"<< endl;
for(int i = 0; i < N; i++){
for(int j = 0; j < M; j++){
cin >> CURRENT[i][j];
}}
//take in input phase
cout << \"Enter \" << N*M << \" values of PHASE: \"<< endl;
for(int i = 0; i < N; i++){
for(int j = 0; j < M; j++){
cin >> PHASE[i][j];
}}
double rate = 0.0;
cout << \"Enter rate: \";
cin >> rate;
cout << \"WATTS: \" << endl;
for(int i = 0; i < N; i++){
for(int j = 0; j < M; j++){
WATTS[i][j] = VOLTS[i][j]*CURRENT[i][j]*cos( x*PHASE[N][M] );
cout << WATTS[i][j] << \" \";
}
cout << endl;
}
cout << \"VARS: \" << endl;
for(int i = 0; i < N; i++){
for(int j = 0; j < M; j++){
VARS[i][j] = VOLTS[i][j]*CURRENT[i][j]*sin( x*PHASE[N][M] );
cout << VARS[i][j] << \" \";
}
cout << endl;
}
cout << \"BILLS: \" << endl;
for(int i = 0; i < N; i++){
for(int j = 0; j < M; j++){
BILLS[i][j] = rate*sqrt( WATTS[i][j]*WATTS[i][j] + VARS[i][j]*VARS[i][j] );
cout << BILLS[i][j] << \" \";
}
cout << endl;
}
return 0;
}
![Write a C/C+ program uses nested for loops to take input values for 3 two dimensional (n x m) arrays, you can name the arrays VOLTS(N1l.l.CURRENT[N][M], PHASE[ Write a C/C+ program uses nested for loops to take input values for 3 two dimensional (n x m) arrays, you can name the arrays VOLTS(N1l.l.CURRENT[N][M], PHASE[](/WebImages/16/write-a-cc-program-uses-nested-for-loops-to-take-input-value-1027481-1761532125-0.webp)
![Write a C/C+ program uses nested for loops to take input values for 3 two dimensional (n x m) arrays, you can name the arrays VOLTS(N1l.l.CURRENT[N][M], PHASE[ Write a C/C+ program uses nested for loops to take input values for 3 two dimensional (n x m) arrays, you can name the arrays VOLTS(N1l.l.CURRENT[N][M], PHASE[](/WebImages/16/write-a-cc-program-uses-nested-for-loops-to-take-input-value-1027481-1761532125-1.webp)