loop

    024 - For Loop 6 (optional)

    024 - For Loop 6 (optional)

    Using a for loop, determine whether the integer variable max is prime or not. If the number is prime, print out "prime". If it's not, print out "not prime". Keep in mind that 1 is NOT a prime number. You can use the following to find the square root of a number (you may or may not use this): Math.sqrt(num) Sample input/outputs: In: 100 out: not prime In: 17 out: prime In: 9 out: not prime In: 1 ..

    023 - For Loops 5

    023 - For Loops 5

    Write a for loop that will loop through every letter of the input and print out just the vowels. Sample input/outputs In: howdyho out:oo In: huehuehuehue out:ueueueue In: poopoo what idk what im doing out:ooooaiaioi 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 import java.util.Scanner; class Main { public static void main(String[] args) { Scanner inp = new Scanner(System.in); System.out.print..

    021 - For Loops 3

    021 - For Loops 3

    Write a for loop that will loop through every character of a word and print out each character, each on a separate line Sample inputs/outputs: In: hello h e l l o 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 import java.util.Scanner; class Main { public static void main(String[] args) { Scanner inp = new Scanner(System.in); System.out.print("In:"); String word = inp.nextLine(); //write your code below..

    020 - For Loops 2

    020 - For Loops 2

    Write a for loop that will print out the numbers starting at 1 and ending at twice the end number exclusive. Each number should be on the same line, separated by a space. Sample inputs/outputs: In: 5 0 1 2 3 4 5 6 7 8 9 In: 10 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 In: -5 (no output) 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 import java.util.Scanner; class Main { public static void..