Cognizant Coding Questions and Answers 2022
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
Sample Input 2:
Enter the digits:
115
116
101
112
Sample Output 2:
115-s
116-t
101-e
112-p
Program :
a=int(input("Digit 1 :
"))
b=int(input("Digit 2 :
"))
c=int(input("Digit 3 :
"))
d=int(input("Digit 4 :
"))
print(str(a)+"-"+chr(a))
print(str(b)+"-"+chr(b))
print(str(c)+"-"+chr(c))
print(str(d)+"-"+chr(d))
for execution and output so check the video :
Comments
Post a Comment