Write Program Displays Squares Numbers 1 10 Recall Square

Write a program that displays the squares of the numbers from 1 to 10. Recall that the square of a number is just the number multiplied by itself. Demonstrate your knowledge of both looping structures by writing two procedures to do this. One procedure should be called, squareFor and the other should be called, squareDoWhile. Each procedure should take no arguments and return no values. Inside the procedure, simply display a message telling what kind of loop it is using and then use the appropriate loop to display the number, followed by its square. When you finish writing these two procedures, write a main procedure that will call both squareFor and squareDoWhile to show that they work. Use JOptionPane for message output.


Study Cred Tutor

4.6 (24k+)

Purchase the answer to view it



Click one of our contacts below to chat on WhatsApp

× How can I help you?