Write a Java program (name it SandClock) that uses nested loops to print out the following shape (sand clock).
*
***
*****
*******
*********
public class SandClock1 { public static void main(String[] args) { int n = 9; int spaces = n/2; for (int i=0; i<n; i+=2) { for (int j=0; j<spaces; j++) { System.out.print(" "); } spaces = spaces - 1; for (int j=0; j<=i; j++) { System.out.print("*"); } System.out.println(); } } }
Write a Java program (name it SandClock) that uses nested loops to print out the following...
Write a java program that will print out the following patters. Use nested for loop.101101010110101
Design (pseudocode)(name it Pattern) that uses nested loops to print out the following pattern. Document your code properly. 1 2 3 4 5 6 1 2 3 4 5 1 2 3 4 1 2 3 1 2 1
in JAVA write a program that produces the following output using nested for loops: +------+ | ^^ | | ^ ^ | |^ ^| | ^^ | | ^ ^ | |^ ^| +------+ | vv | | v v | |v v| | vv | | v v | |v v| +------+
Write a Java program that uses nested for loops to print a multiplication table as shown below. Make sure to include the table headings and separators as shown. The values in the body of the table should be computed using the values in the heading e.g. row 1 column 3 is 1 times 3. * | 1 2 3 4 5 6 7 8 9 4 | 1| 1 2 3 456 7 8 9 2 | 2 4 6.8...
Java: makes sure program compiles before posting. Write a program that uses nested for loops to create the pattern of Xs and Os, in which on every line each letter is displayed one additional space to the right. Use a toggle variable ( a boolean flag) to alternate between X and O to produce output as shown in the sample run below: Enter the number of lines: 7 X O X O X O X
Java Write a program in Java using “Nested For Loop” to print following pattern. AAA AAA C566 AAA C566 AAA AAA C566 AAA AAA AAA C566 AAA AAA AAA
MATLAB Write segment of code using nested for loops to print out the following pattern. Your segments of code should prompt the user for a positive integer, n, and print the following star pattern depending on n. An equilateral triangle. Pictured below is case n = 6. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *...
.Need code for my java class !! Write a simple java program that uses loops. You may use ‘WHILE’ or ‘FOR’ or ‘DO-WHILE’ – you decide. The program should use a loop to compute the semester average for up to 5 students. In the loop the user will ask for a student name and their 3 test scores and add them up and divide the total by 3 giving the semester average. You will print out the student name and...
Turtle Graphics with nested loop: Write a turtle graphics python program repeat_squares.py that uses nested loops to draw 100 squares, to create this design: Turtle-squares.png starting with the smallest square in the bottom right-hand corner. Start at position (-4,4). At each step increase the length of each side by 4 pixels. Draw 100 squares. Please submit with an animation speed of 0 and the turtle hidden turtle.hideturtle()
Write a Python program (using a nested loop) to print out the following pattern (there is a space between the numbers next to each other). 1 2 1 3 2 1 4 3 2 1 5 4 3 2 1