Upload files to "Aufgaben/PTP_1"

This commit is contained in:
2025-07-29 08:24:47 +02:00
parent 01bab967a2
commit e55131f032
4 changed files with 90 additions and 0 deletions

View File

@@ -0,0 +1,16 @@
import java.util.Scanner;
public class Eingabe {
public static void main(String args[]){
Scanner eingabe = new Scanner(System.in);
System.out.print("Bitte eine ganze Zahl eingeben: ");
if(eingabe.hasNextInt()){
int zahl = eingabe.nextInt();
System.out.println("Das Quadrat von " + zahl + " ist " + (zahl * zahl));
}
else {
System.out.println("Bitte nur ganze Zahlen eingeben!!");
}
}
}