Use AVR Studio50 ATmega32A Create a program that iterates th
Use AVR Studio5.0 ATmega32A
Create a program that iterates through the capital letters of the alphabet (A - Z), outputting the ASCII value for each letter on Port B of the processor.
Solution
import java.io.*;
import java.lang.*;
public class CharToASCII //Here We are taking class name as CharToASCII
{
public static void main(String args[]) throws IOException
{
char ch;
BufferedReader buff = new BufferedReader(new InputStreamReader(System.in));//Reading Input from the keyboard
for( ch = \'A\' ; ch <= \'Z\' ; ch++ )
System.out.println(ch); // Printing UpperCase Alphabets Here
System.out.println(\"Enter the char:\"); // Here User input the Any Char to find it\'s Ascii Value
String str = buff.readLine(); // Scanning Input
for ( int i = 0; i < str.length(); ++i ){
char c = str.charAt(i);
int j = (int) c; // Here Converting Character value to integer value
System.out.println(\"ASCII VALUE \"+c +\" = \" + j + \".\"); // Printing ASCII value
}
}
}
Output:
A
B
C
D
E
F
G
H
I
J
K
L
M
N
O
P
Q
R
S
T
U
V
W
X
Y
Z
Enter the char:
A
ASCII VALUE = 65

