forked from Abhijith14/JavaElab
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTypeCastingproblem.java
More file actions
25 lines (20 loc) · 34.3 KB
/
TypeCastingproblem.java
File metadata and controls
25 lines (20 loc) · 34.3 KB
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
//Q. 11:
//TypeCastingproblem(DatatypesandOperators)
/*
Get an integer as input and convert it to float via long data type.
Output Values:
1. Integer type
2. Long Type
3. Float Data type
*/
import java.io.*;
import java.util.Scanner;
public class TestClass {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int num = sc.nextInt();
System.out.println("Int value " + num);
System.out.println("Long value " + (long)num);
System.out.println("Float value " + (float)num);
}
}