Answer:
PART ONE
- import java.util.Scanner;
- public class CountToLimit {
- public static void main(String[] args) {
- Scanner scnr = new Scanner(System.in);
- int countLimit = 0;
- int printVal = 0;
- // Get user input
- System.out.println("Enter Count Limit");
- countLimit = scnr.nextInt();
- do {
- System.out.print(printVal + " ");
- printVal = printVal + 1;
- } while ( printVal<=countLimit );
- System.out.println("");
- return;
- }
- }
PART TWO
- import java.util.Scanner;
- public class NumberPrompt {
- public static void main (String [] args) {
- Scanner scnr = new Scanner(System.in);
- System.out.print("Your number < 100: ");
- int userInput = scnr.nextInt();
- do {
- System.out.print("Your number < 100: ");
- userInput = scnr.nextInt();
- }while (userInput>=100);
- System.out.println("Your number < 100 is: " + userInput);
- return;
- }
- }
Explanation:
In Part one of the question, The condition for the do...while loop had to be stated this is stated on line 14
In part 2, A do....while loop that will repeatedly prompt user to enter a number less than 100 is created. from line 7 to line 10
It is hi5 if I’m a Plato class
Answer:
dog
Explanation:
The python program has four lists, A, B, C, and E which is a list of the first three lists. Lists are unordered indexed data structures, it is accessed by an index starting from 0 to n (which is the length of the list minus one).
The E list is a list of lists with three list items starting from index zero to two. E[0][1] is used to access the item "dog" in the first list item of the E list.
Answer:
FOR i% = 1 TO 100
IF ((i%\3) = i%/3) AND ((i%\7) = i%/7) THEN
PRINT i%
END IF
NEXT i%
Explanation:
Of course using MOD would be cleaner, but another way to check if a number is integer divisable is to compare the outcome of an integer division to the outcome of a floating-point division. If they are equal, the division is an integer division.
The program outputs:
21
42
63
84