-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain1.java
24 lines (21 loc) · 957 Bytes
/
main1.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import java.util.Scanner;
public class main1 {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
System.out.print("Enter your birth year: ");
int a = sc.nextInt(); // Taking input as integer
int age = 2023 - a;
System.out.print("Enter your marks: ");
float marks = sc.nextFloat(); // Taking input as float
System.out.print("Enter your Name: ");
String name1 = sc.nextLine(); // Taking input as single word string
// System.out.print("Tell me about yourself: ");
// String intro = sc.nextLine(); // Taking input as single line
System.out.println("================================");
System.out.println("Your name is : " + name1);
// System.out.println("My Intro: " +intro);
System.out.println("Your current age = " + age);
System.out.println("Your marks are : "+ marks);
sc.close();
}
}