Write a program that asks the user for a number. If the number is between 1 and 255, the program outputs the corresponding ASCII character. If it is outside of that range, the program outputs Out of range.
Answers
Answered by
1
Answer:
Program in Java:
import java.util.*;
class Ascii
{
public static void main ()
{
Scanner sc=new Scanner (System.in);
int n;
System.out.println ("Enter a number");
n=sc.nextInt ();
if (n >=1 && n<=255)
System.out.println ("Corresponding Character: "+char (n));
else
System.out.println ("Out of Range");
}
}
Explanation:
Program in python:
n=int (input ("Enter a number:\n"))
if n>=1 and n <=255 :
print ("Corresponding Character:" , chr (n))
else:
print ("Out of Range")
------------------------------------x-----------------------------------
I hope this helps you so please rate it the brainliest
Similar questions
English,
5 months ago
India Languages,
10 months ago
India Languages,
10 months ago
Environmental Sciences,
1 year ago
Environmental Sciences,
1 year ago