answersLogoWhite

0

AllQ&AStudy Guides
Best answer

All the smallest factors of a number must be its smallest factor, which for any number is 1, so:

loop

loop

loop

print "Enter an integer number: ":

input n

until num(n) do

print "Please enter a number"

repeat

until n = int(n) do

print "Please enter an integer"

repeat

print "Smallest factor of ":n:" is 1"

repeat

This answer is:
Related answers

All the smallest factors of a number must be its smallest factor, which for any number is 1, so:

loop

loop

loop

print "Enter an integer number: ":

input n

until num(n) do

print "Please enter a number"

repeat

until n = int(n) do

print "Please enter an integer"

repeat

print "Smallest factor of ":n:" is 1"

repeat

View page

how to print "square" using for loop

View page

Add the numbers into one variable as you read them in. But if you prefer, you can read the numbers into an array and then use a loop to add the numbers together.

View page

A for loop is typically used to implement a counted loop:

for x=0 to 100 step 1

print x

next x

View page

Move the print out requesting the user to enter an integer outside of the for loop and it will only print once instead of each time around the loop.

You'll need a way to save the even and odd numbers that you detect in the loop.

One way is to have separate arrays to hold the even and the odd numbers as you go around the loop. Then at the end of the loop you can have more loops to print the contents of one array and then the contents of the other array.

Another way is to concatenate the number onto separate Strings (even and odd) to be displayed after the data gathering loop.

View page
Featured study guide
📓
See all Study Guides
✍️
Create a Study Guide
Search results