Answered step by step
Verified Expert Solution
Link Copied!

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

The Database Management Systems

Authors: Patricia Ward, George A Dafoulas

1st Edition

ISBN: 1844804526, 978-1844804528

More Books

Students also viewed these Databases questions

Question

LO5 Highlight five external recruiting sources.

Answered: 1 week ago