-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCognizant_Q3.java
More file actions
39 lines (32 loc) · 818 Bytes
/
Cognizant_Q3.java
File metadata and controls
39 lines (32 loc) · 818 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
30
31
32
33
34
35
36
37
38
39
/*Problem Statement – Ritik wants a magic board, which displays a character for a corresponding number for his science project. Help him to develop such an application.
For example when the digits 65,66,67,68 are entered, the alphabet ABCD are to be displayed.
[Assume the number of inputs should be always 4 ]
Sample Input 1:
Enter the digits:
65
66
67
68
Sample Output 1:
65-A
66-B
67-C
68-D*/
package technical;
import java.util.*;
public class Cogni3 {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int x[]= new int[4];
System.out.println("enter the digits");
for (int i =0;i<x.length;i++)
{
x[i]=sc.nextInt();
}
for(int i =0;i<x.length;i++)
{
char ch = (char)x[i];//type-casting the integer to char.
System.out.println(x[i]+"-"+ch);
}
}
}