Answered step by step
Verified Expert Solution
Question
1 Approved Answer
1. What is the value of variable num after the following code segment? var num = 10; while ( num > 0 ) { num
1.
What is the value of variable num after the following code segment?
var num = 10;
while ( num > 0 ) {
num = num -1;
}
2.
What is the value of variable num after the following code segment is executed?
var num = 1;
while ( num >10 ) {
num = num -1;
}
3.
What is the sum of roll1 and roll2 after the following code is executed?
var roll1=0; var roll2=0;
while ( roll1+roll2!=6 ) {
roll1=Math.floor(Math.random( )*6+1);
roll2=Math.floor(Math.random( )*6+1);
}
4.Compare and contrast a while statement and an if statement ?
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started