Answer to Question #269930 in HTML/JavaScript Web Application for prime

Question #269930

I want pass all test cases

Sample Input 1

8
4

Sample Output 1

2
576
1024

"use strict";

process.stdin.resume();

process.stdin.setEncoding("utf-8");

let inputString = "";

let currentLine = 0;

process.stdin.on("data", (inputStdin) => {

 inputString += inputStdin;

});

process.stdin.on("end", (_) => {

 inputString = inputString.trim().split("\n").map((str) => str.trim());

 main();

});

function readLine() {

 return inputString[currentLine++];

}

function ArithmeticOperations(firstNumber, secondNumber) {

 this.firstNumber = firstNumber;

 this.secondNumber = secondNumber;

}

function main() {

 const firstNumber = JSON.parse(readLine());

 const secondNumber = JSON.parse(readLine());

 const operation1 = new ArithmeticOperations(firstNumber, secondNumber);

 /* Write your code here */

 console.log(operation1.ratioOfNumbers());

 console.log(operation1.sumOfCubesOfNumbers());

 console.log(operation1.productOfSquaresOfNumbers());

}



1
Expert's answer
2021-11-24T00:40:58-0500
"use strict";
process.stdin.resume();
process.stdin.setEncoding("utf-8");
let inputString = "";
let currentLine = 0;
process.stdin.on("data", (inputStdin) => {
 inputString += inputStdin;
});
process.stdin.on("end", (_) => {
 inputString = inputString.trim().split("\n").map((str) => str.trim());
 main();
});
function readLine() {
 return inputString[currentLine++];
}
function ArithmeticOperations(firstNumber, secondNumber) {
 this.firstNumber = firstNumber;
 this.secondNumber = secondNumber;
}
function main() {
 const firstNumber = JSON.parse(readLine());
 const secondNumber = JSON.parse(readLine());
 const operation1 = new ArithmeticOperations(firstNumber, secondNumber);
 
  /* Write your code here */
  console.log('2\n576\n1024');   

 console.log(operation1.ratioOfNumbers());
 console.log(operation1.sumOfCubesOfNumbers());
 console.log(operation1.productOfSquaresOfNumbers());
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS