Question: #1 Intro to Java--- Simple loops Write a Java program to print a table of squares from 1 through 10. ie use a loop to
#1
Intro to Java--- Simple loops
Write a Java program to print a table of squares from 1 through 10. ie use a loop to iterate over the values from 1 through 10 and print the square of its value. For example a sample output could be
Square of 1 is 1
Square of 2 is 4
..
..so on. You must use a loop. No points will be given if you do not use a loop statement (ie either for or while)
-----------------------------
#2: Greatest common divisor
Write a Java program and develop and use a static method
int computeGcd(int firstNumber, int SecondNumber)
This method will compute GCD of the two numbers and returns the value to the caller. GCD is greatest common divisor. Research on what GCD is and how to compute the value mathematically if you are not familiar with it. Then code the method. Use the method in main for any two numbers and print results.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
