What type of number will be stored in the variable, UpTo5, due to the - ProProfs Discuss
Topics-
Products +
     

What type of number will be stored in the variable, UpTo5, due to the following line of code in cmfFive?
UpTo5 = 5 * Rnd



A. A random decimal less than 5
B. A random decimal from 0 to 5
C. A random integer from 0 to 5
D. A random integer from 0 to 5000
Asked by Kayla, Last updated: Jan 11, 2018

This question is part of

Random Numbers with Rnd

+ AnswerRequest Answer
...

1 Answer

John Smith

John Smith

Answered on Sep 08, 2016

A random integer from 0 to 5-since upto5 is declared as an integer whatever number is stored in it must be an integer. when an attempt to store a decimal occurs, the digits after the decimal point will be chopped off. depending on the programming language the number might be rounded to the nearest integer. example: 5 .00005 results in .00025 which rounds to 0 example: 5 .1047 results in .5235 which rounds to 1example: 5 .34201 results in 1.71005 which rounds to 2example: 5 .541 results in 2.705 which rounds to 3example: 5 .6 results in 3example: 5 .8 results in 4 example: 5 .987 results in 4.935 which rounds to 5
 Reply

Search for Google images
Select a recommended image
Upload from your computer
Search for Google images
Select a recommended image
Upload from your computer
Search for Google images
Select a recommended image
Upload from your computer

Email Sent
We have sent an email to your address "" with instructions to reset your password.