Skip to main content

Posts

You are given three numbers A, B & C. Print the largest amongst these three numbers.

You are given three numbers  A ,  B  &  C . Print the largest amongst these three numbers. Input Description: Three numbers are provided to you. Output Description: Find and print the largest among the three Sample Input : 1 2 3 Sample Output : 3 const readline = require('readline'); const inp = readline.createInterface({ input: process.stdin });const userInput = [];inp.on("line", (data) => { userInput.push(data); }); inp.on("close", () => { var a = parseInt(userInput[0]); var b = parseInt(userInput[1]); var c = parseInt(userInput[2]); var d=Math.max(a,b,c) console.log(d); });
Recent posts

You are given Two Numbers, A and B. If C = A + B. Find C.

You are given Two Numbers, A and B. If C = A + B. Find C. Note: Round off the output to a single decimal place. Input Description: You are provided with two numbers A and B. Output Description: Find the sum of the two numbers (A + B) Sample Input : 1 1 Sample Output : 2 const readline = require('readline'); const inp = readline.createInterface({ input: process.stdin }); const userInput = []; inp.on("line", (data) => { userInput.push(data); }); inp.on("close", () => {var a = parseInt(userInput[0]); var b = parseInt(userInput[1]); var c=a+b console.log(c.toFixed(1)); });

You are provided with a number check whether its odd or even.

You are provided with a number check whether its odd or even.  Print "Odd" or "Even" for the corresponding cases. Note: In case of a decimal, Round off to nearest integer and then find the output. Incase the input is zero, print "Zero". Input Description: A number is provided as the input. Output Description: Find out whether the number is odd or even. Print "Odd" or "Even" for the corresponding cases. Note: In case of a decimal, Round off to nearest integer and then find the output. In case the input is zero, print "Zero". Sample Input : 2 Sample Output : Even const readline = require('readline'); const inp = readline.createInterface({ input: process.stdin }); const userInput = []; inp.on("line", (data) => { userInput.push(data); }); inp.on("close", () => { var data = userInput[0].split(" "); var a = parseFloat(data[0]); var b=Math.round(a); if(b==0) consol...

You are given a number A in Kilometers. Convert this into B: Meters and C: Centi-Metres.

You are given a number  A  in Kilometers . Convert this into  B : Meters and  C : Centi-Metres . Input Description: A number "A" representing some distance in kilometer is provided to you as the input. Output Description: Convert and print this value in meters and centimeters. Sample Input : 2 Sample Output : 2000 200000 const readline = require('readline'); const inp = readline.createInterface({ input: process.stdin }); const userInput = []; inp.on("line", (data) => { userInput.push(data); }); inp.on("close", () => {var a = parseInt(userInput[0]); var b = (a*1000); var c=(b*100); console.log(b); console.log(c); });

You are provided with a number "N", Find the Nth term of the series: 1, 4, 9, 25, 36, 49, 64, 81, .......

You are provided with a number " N ", Find the  N th  term of the series: 1, 4, 9, 25, 36, 49, 64, 81, ....... (Print " Error " if N = negative value and 0 if  N = 0). Input Description: An integer N is provided to you as the input. Output Description: Find the Nth term in the provided series. Sample Input : 18 Sample Output : 324 const readline = require('readline'); const inp = readline.createInterface({ input: process.stdin }); const userInput = []; inp.on("line", (data) => { userInput.push(data); }); inp.on("close", () => { var data = userInput[0].split(" "); var a = parseInt(data[0]); console.log(a*a); });

You are provided with two numbers. Find and print the smaller number.

You are provided with two numbers. Find and print the smaller number. Input Description: You are provided with two numbers as input. Output Description: Print the small number out of the two numbers. Sample Input : 23 1 Sample Output : 1 const readline = require('readline'); const inp = readline.createInterface({ input: process.stdin }); const userInput = []; inp.on("line", (data) => { userInput.push(data); }); inp.on("close", () => { var data = userInput[0].split(" "); var a = parseInt(data[0]); var b = parseInt(data[1]); console.log(Math.min(a,b)); });

Using the method of looping, write a program to print the table of 9 till N in the format as follows: (N is input by the user)

Using the method of looping, write a program to print the table of 9 till N in the format as follows: (N is input by the user) 9 18 27... Print NULL if 0 is input Input Description: A positive integer is provided as an input. Output Description: Print the table of nine with single space between the elements till the number that is input. Sample Input : 3 Sample Output : 9 18 27 const readline = require('readline'); const inp = readline.createInterface({ input: process.stdin }); const userInput = []; inp.on("line", (data) => { userInput.push(data); }); inp.on("close", () => { var data = userInput[0].split(" "); var N = parseInt(data[0]); var a=[]; for(i=1;i<=N;i++) {a[i-1]=9*i;} var b=""; for(i=0;i<N;i++) {if(i==N-1) b=b+a[i] else (b=b+a[i]+" ") } console.log(b) });