Created
October 20, 2015 11:24
-
-
Save edinak1/5277e8ece4c3729c3f77 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package metod; | |
| public class MetodSquare { | |
| public static void main(String[] args) { | |
| double number1=2.0; | |
| int number2=4; | |
| System.out.println(number1+"^2"+"="+square(number1)); | |
| System.out.println(number1+"^4"+"="+square(square(number1))); | |
| System.out.println(number1+"^8"+"="+square(square(square(number1)))); | |
| System.out.println(number2+"^2"+"="+square(number2)); | |
| System.out.println(number2+"^4"+"="+square(square(number2))); | |
| System.out.println(number2+"^8"+"="+square(square(square(number2)))); | |
| } | |
| static double square(double number) | |
| { | |
| return number*number; | |
| } | |
| static int square(int number) | |
| { | |
| return number*number; | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment