Computer Science, asked by abbas22raza, 10 months ago

write a program to obtain a string from the user. find and print index, its corresponding character and ascii value of all characters​

Answers

Answered by Tuahar07
2

Answer:

Python code using ord function :

ord() : It coverts the given string of length one, return an integer representing the unicode code point of the character. For example, ord(‘a’) returns the integer 97.

C code: We use format specifier here to give numeric value of character. Here %d is used to convert character to its ASCII value.

C++ code: Here int() is used to convert character to its ASCII value.

Java code : Here, to find the ASCII value of c, we just assign c to an int variable ascii. Internally, Java converts the character value to an ASCII value.

C# code : Here, to find the ASCII value of c, we just assign c to an int variable ascii. Internally, C# converts the character value to an ASCII value.

Similar questions