Binary - Sum ASCII Values
Coding Problem Keys
Binary - Sum ASCII Values
Problem Statement
The program must accept three alphabets as the input. The program must form an integer X by adding the ASCII values of those three alphabets. Then the program must print the binary representation of X as the output.
Input Format
The first line contains three alphabets separated by a space.
Output Format
The first line contains the binary representation of X.Example Input/Output 1
Input
a b c
Output
100100110
Explanation
The ASCII value of a is 97.
The ASCII value of b is 98.
The ASCII value of c is 99.
So their sum is 294 (97+98+99).
The binary representation of 294 is 100100110.
Example Input/Output 2
Input
C S KOutput
11100001
Max Execution Time Limit: 500 millisecs
Solution
Programming Language: Python 3 Language
a,b,c=map(str,input().split())
x=ord(a)+ord(b)+ord(c)
print(bin(x)[2:])
# Published By PKJCODERS
(Note: Incase If the code doesn't Pass the output kindly comment us with your feedback to help us improvise.)
Comments