The document contains Java code that takes in an odd integer from the user and prints out a diamond shape pattern of asterisks of that size. It first checks that the input is odd, then uses nested for loops to print spaces and asterisks in the correct positions to create the shape with asterisks at the edges and center decreasing to a single asterisk at the middle and then increasing back out.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0 ratings0% found this document useful (0 votes)
24 views2 pages
BW
The document contains Java code that takes in an odd integer from the user and prints out a diamond shape pattern of asterisks of that size. It first checks that the input is odd, then uses nested for loops to print spaces and asterisks in the correct positions to create the shape with asterisks at the edges and center decreasing to a single asterisk at the middle and then increasing back out.