WAP to take two characters as input calculate and print the sum and different of their ASCLL values. Sample Input 'A' , 'CC' output. The sum of Ascll values: 132 The difference of Ascil values - 2
Answers
Answered by
1
refer the attachment hope its help u
Attachments:
Answered by
0
Answer:
import java.util.*;
import java.io.*;
public class Main
{
public static void main(String[] args) throws Exception{
System.out.print("Enter char 1:");
char c = (char)System.in.read();
System.out.print("Enter char 2:");
char c1 = (char)System.in.read();
int x = (int)c;
int y = (int)c1;
System.out.println("The sum of ascii values is: "+ (x+y));
}
}
Explanation:
Similar questions