Skip to content

Instantly share code, notes, and snippets.

@edinak1
Created October 20, 2015 11:24
Show Gist options
  • Select an option

  • Save edinak1/5277e8ece4c3729c3f77 to your computer and use it in GitHub Desktop.

Select an option

Save edinak1/5277e8ece4c3729c3f77 to your computer and use it in GitHub Desktop.
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