Skip to content

Instantly share code, notes, and snippets.

@denkspuren
Created October 31, 2020 17:24
Show Gist options
  • Save denkspuren/add79663b40d7f46b2039832ee80d460 to your computer and use it in GitHub Desktop.
Save denkspuren/add79663b40d7f46b2039832ee80d460 to your computer and use it in GitHub Desktop.
Berechnung einer Quadratzahl
import java.util.Scanner;
public class Calculator {
public static void main(String... args) {
Scanner input = new Scanner(System.in);
System.out.print("Input number: ");
int n = input.nextInt();
System.out.println("The square of " + n + " is " + square(n));
}
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