Untitled
Anonymous
Plain Text
10/14/2025 1:56 PM
840 B
17
Indexable
Never
package LogicalProblems;
import java.util.Scanner;
public class Ascii {
/**
*This class Takes a single character c. Your task is to find and return the ASCII value of the given character.
*
* Examples:
* Input: c = 'A'
* Output: 65
* Explanation: The ASCII value of uppercase 'A' is 65.
*
* Input: c = 'e'
* Output: 101
* Explanation: The ASCII value of lowercase 'e' is 101.
*/
public static int findAscii(char c){
int ASC11 = (int) c;
return ASC11;
}
public static void main(String[] args) {
Scanner s = new Scanner(System.in);
System.out.print("ENTER A CHARACTER TO FIND ASCII -> ");
String str = s.next();
char c = str.charAt(0);
System.out.println("ASCII OF " + c + " IS -> " + findAscii(c));
}
}
Editor is loading...
Leave a Comment