/*Copyright ElohimTov LLC*/ /* //Name: ElohimTov Solve Code - Data Types - Javascript Solution //Problem: HackerRank - 30 Days of Code - Data Types //Current File: ElohimTovSolve_DataTypes.(js).txt //Compile-able File: ElohimTovSolve_DataTypes.js //Date: Created 10/25/2018; 12/31/2021 //Tale: ElohimTov Solve's Solution to HackerRank.com's // Data Types problem in Javascript programming language. // Problem link at https://elohimtov.com/elohimtov.info. */ /* +++++++++++++++++++++++++++++++++++++++ */ /* Code provided by HackerRank.com begins. */ process.stdin.resume(); process.stdin.setEncoding('ascii'); var input_stdin = ""; var input_stdin_array = ""; var input_currentline = 0; process.stdin.on('data', function (data) { input_stdin += data; }); process.stdin.on('end', function () { input_stdin_array = input_stdin.split("\n"); main(); }); // Reads complete line from STDIN function readLine() { return input_stdin_array[input_currentline++]; } /* Code provided by HackerRank.com ends. */ /* +++++++++++++++++++++++++++++++++++++++ */ function main() { var i = 4 var d = 4.0 var s = "HackerRank " /* Declare second integer, double, and String variables. */ var i2, d2, s2; /* Read and save an integer, double, and String to your variables. */ i2 = readLine(); i2 = String(i2); var i3 = parseInt(i2); d1 = readLine(); d2 = String(d1); var d3 = parseFloat(d1); s2 = readLine(); /* Print the sum of both integer variables on a new line. */ var i_sum = i + i3; console.log(i_sum); /* Print the sum of the double variables on a new line. */ var d_sum = d + d3; console.log(d_sum.toFixed(1)); /* //Concatenate and print the String variables on a new line //The 's' variable above should be printed first. */ var s_sum = s + s2; process.stdout.write(s_sum); process.stdout.write("\n"); }// ends function main /*Copyright ElohimTov LLC*/