"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 main() {
let integers = JSON.parse(readLine());
/* Please do not modify anything above this line */
/* Write your code here and log the output */
const productArrayItems = arr => arr.reduce((a, b) => a * b)
console.log(productArrayItems(integers));
}
notthis output ----> 1*2*3=6
write a c++ programe which calculates sum of each column and row separately .for this, first create a 2D array 3 rows , 5 columns and then ask the user to input values in the array . after that , first calculate sum of each row separately and display that sum. then calculate sum of each column separatel and display that sum on the screen. to achieve such output , ou need to follow the following instructions?
Harrypotter is visiting his uncle’s house ,the house of Black ,and ants to know more about the family through their ancestral tree.He notices that the ancestraltreebegins with the head of the family at the top,having 2 children as his descendants,This pattern is followed throught and each member is represented by unique integer.
Given relationships in the form ofan integer arraywhere the head of the family is at the first position (i=0) and his children areat position (2*i+1) and (2*i+2).
Your task is to help harry find and return all the siblings of any given family member and return them in the form of a sorted array.
Note:if there are no siblings ,return {-1}.
Example:
Input1:5
Input2:{1,2,3,4,5}
Input3:1
Output:{-1}
you want tobuy a particular stock at its loerest price andsell it later at its highest price,since the stock market is unpredictable,yousteal the price plans of a company for this stockfor the next N days.
Find the best price you can get to buy this stock to achieve maximum profit.
Note:The initial price of the stock is 0.
Input1:Nnumber of days.
Input2:Array representing changein stock price for the day.
Output: Your function must return the best price to buy the stock at.
Example:
Input1:5
Input2:{-39957,-17136,35466,21820,-26711}
Output:-57093
Area and circumference a circle
"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++];
}
/* Please do not modify anything above this line */
function Circle(radius) {
/* Write your code here */
}
/* Please do not modify anything below this line */
function main() {
const radius = JSON.parse(readLine());
const circle1 = new Circle(radius);
console.log(circle1.getArea());
console.log(circle1.getCircumference());
}
Input:7
Output:153.86
43.96
Consider the following declaration and the statements (a) to (d) written in C. Identify the statement which are correct and the ones which has an error, by giving reason. If a statement has an error correct it.
int c = 1, *pc; // declaration
(a) pc = c;
(b) *pc = &c;
(c) pc = &c;
(d) *pc = c;
Write short answers for each of the following:
(a) Name the operator that is used to declare a pointer variable.
(b) If pt is an integer pointer variable, what is the value that this pointer variable can have? (c) List the three values that can be used to initialize a pointer variable.
(d) Name and give the symbol of the operator that returns the location in memory where its operand is stored.
create a console application in area of the square
Write a program to take input for n number of doctor records and write records of all cardiologists in a file named: “record1”. Also write records of all those doctors in another file named: “record2” who are taking salary more than INR 80,000. After writing records in both files, merge their contents in another file: “finalrecord” and read all records of “finalrecord” file and display on screen. [Attributes of doctor: doc_id, doc_name, doc_specialization, doc_salary]
Type a number: 5
Type another number: 2
Sum is :7