1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
ladessa [460]
3 years ago
15

Instructions Write a program that asks the user for a number. If the number is between 1 and 255, the program outputs the corres

ponding ASCII character. If it is outside of that range, the program outputs Out of range.
Computers and Technology
1 answer:
Alenkasestr [34]3 years ago
8 0

Answer:

import java.util.Scanner;

public class num5 {

   public static void main(String[] args) {

       Scanner in = new Scanner(System.in);

       System.out.println("Enter a number between 1 -255");

       int num = in.nextInt();

       if(num >= 1 && num<=255){

           char c = (char)num;

           System.out.println("The ASCII Value of "+num+" is "+c);

       }

       else{

           System.out.println("Out of range");

       }

   }

}

Explanation:

  • Use the scanner class to receive a number from the user save in a variable num
  • Use if statement to ensure the number is within the valid range num >= 1 && num<=255
  • Convert the number to the ASCII equivalent by casting it to char data type
  • Output the number and the ASCII equivalent
  • if num was out of range, print Out of range

You might be interested in
I have wings, I am able to fly, I‘m not a bird yet I soar high in the sky. What am I?
yanalaym [24]
You are a butterfly!!
6 0
3 years ago
Read 2 more answers
I want to build a video player on the html5 canvas here is my code
jok3333 [9.3K]

Answer:

hospital yestrday after noon ggpupg ki tyutrdcbhsjdvshsjjshsgsgdhsusfsuwwiiwhszia

8 0
1 year ago
What is a computer attack where an attacker accesses a wireless computer network, intercepts data, uses network services, and/or
Harman [31]

Answer:

The correct answer to the following question is Drive-by hacking .

Explanation:

Drive-by hacking is the type of hacking which comes under the cyberterrorism.

Drive-by hacking is the hacking where the hackers can access their data and steal their data, use their network services from some "safe" distance without going inside the company or an organization.

Drive-by download is the type of download of the malicious code into your mobile devices or the computers which occur by designed and it leave you to the cyberattack.

7 0
3 years ago
To find resources on the Internet for your courses, you may need to use a search engine. Suppose that you are collecting informa
tekilochka [14]

Answer:

d. "Columbus, Wisconsin"

Explanation:

mark me brainliest please

8 0
3 years ago
What does different screen size have to do with the display apperance of sites?
lesantik [10]
Display quality, or fit
7 0
2 years ago
Other questions:
  • The ____ contains methods that allow you to set physical properties such as height and width, as well as methods that allow you
    14·1 answer
  • Isaac is researching Abraham Lincoln’s life for a social studies report. He finds an encyclopedia that includes original letters
    5·2 answers
  • What type of topology gives you a direct connection between two routers so that there is one communication path?
    14·1 answer
  • How is a ink pen better than a digital pen.
    8·1 answer
  • Which CSS attribute would change an element's font color to blue
    15·2 answers
  • When was internet started in which year​
    13·2 answers
  • This is for being Weird!
    15·2 answers
  • Jack used primarily web sources for his informative speech about gun control. however, his over-reliance on the web site sponsor
    11·1 answer
  • What is boolean rules​
    12·1 answer
  • Explain the characteristics of 1st generation computers​
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!