-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathage.java
More file actions
29 lines (23 loc) · 991 Bytes
/
age.java
File metadata and controls
29 lines (23 loc) · 991 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import java.util.Scanner;
class age {
public static void main(String [] args) {
int age;
Scanner scanner = new Scanner(System.in);
System.out.println("Hallo , wie heißt du ?");
String name = scanner.nextLine();
System.out.println("Welches Jahr haben wir" +" "+ name + "?");
int year = scanner.nextInt();
System.out.println("jahre " + year );
System.out.println("In welchem Jahr bist du geboren?" );
int yearBorn = scanner.nextInt();
System.out.println("geboren jahr : " + yearBorn );
System.out.println("Hattest du dieses Jahr schon Geburtstag?");
System.out.println("Für ja gebe 0 für nein 1 ein: ");
int zahl = scanner.nextInt();
if (zahl == 0 ){
age = year - yearBorn;
System.out.println(name +" ," + "du bist " + age + " Jahre alt" );
} else if (zahl == 1) {
}
}
}