Signup/Sign In

Answers

All questions must be answered. Here are the Answers given by this user in the Forum.

Here is an example of finding sum and average of array of prime numbers
***
int[] arr = {2, 3, 5, 7, 11, 13, 17, 19, 23, 29}; // array of prime no.
int n = 4; // nth prime
int prime = arr[n-1]; // arrays are zero-indexed
int sum = Arrays.stream(arr).limit(n).sum(); // sum of the first n primes in the array
double average = (double) sum / n; // average of the first n primes in the array
***
2 years ago
Try this code:

***



My Webpage Title


Do you know?


The human brain takes in 11 million bits of information every second but is aware of only 40.




***
2 years ago
Please share the Level and Lesson number with the code you're using.
2 years ago
Try this code:

***



My Webpage Title


Do you know?


The human brain takes in 11 million bits of information every second but is aware of only 40.




***
2 years ago
You haven't implemented if block correctly. Use Opening and closing curly brackets

***
let x = 0;

while(x < 10)
{
console.log(x);
if(x == 5) {
break;
}
x++;
}
***
2 years ago
***// defining a function
function he\lloJS() {
console.log("Hello World!");
}

// calling the function
he\lloJS()***
2 years ago
Start by learning a programming language following tutorials on Studytonight.
2 years ago
You have to use **teaHour%4** instead of **teaHour** like shown in the following code.

***function teaBreak(){
console.log("Start making tea");
console.log("Tea ready");
console.log("Enjoy the tea");
}

let teaHour;

for(teaHour=1; teaHour<=12; teaHour++)
{
if(teaHour%4 == 0)
{
teaBreak();
}
}***
2 years ago
Hi Sumit, The contents of style tag should be like this.
***@media (min-width: 550px) {
body {
font-size:25px;
}
}
***
2 years ago
Hi there, Thanks for pointing it out. We will fix the Lesson. For now you can use this solution to move forward.
***let player = {
name: "default_name",
weapon: "Pistol",
exp: "Pro",

// defining method
setName: function(name) {
this.name = name;
},
getName: function() {
return this.name;
},
showInfo: function() {
console.log(`${this.getName()} uses ${this.weapon} and is ${this.exp} level player in STBattleRoyal`);
}
};

player.setName("John Wick");
player.showInfo();***
2 years ago
Hi, Please specify the Lesson, Level and the error you got while submitting. Thanks.
2 years ago