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
Aleksandr-060686 [28]
3 years ago
11

Square a Number This is a practice programming challenge. Use this screen to explore the programming interface and try the simpl

e challenge below. Nothing you do on this page will be recorded. When you are ready to proceed to your first scored challenge, click "Finish Practicing" above. Programming challenge description: Write a program that squares an integer and prints the result. Input: Your program should read lines from standard input. Each line will contain a positive integer. Output: For each line of input, print to standard output the square of the number. Print out each result on a new line.
Computers and Technology
1 answer:
yan [13]3 years ago
3 0

Answer:

import java.io.*;

public class Main {

  public static void main(String[] args) throws IOException {

      BufferedReader brObject = new BufferedReader(new InputStreamReader(System.in));

      String str;

      while ((str = brObject.readLine()) != null) {

          int number = Integer.parseInt(str);

          System.out.println(number * number);

      }

  }

}

Explanation:

  • Inside the main method, create an object of BufferedReader class to read lines from standard input.
  • Declare a string and run a while loop until it reaches the end of the input.
  • Inside the while loop convert the string into an integer data type.
  • Finally display the output by squaring the number.
You might be interested in
What is the foundational domain for business
mr Goodwill [35]

a fundamental domain or fundamental region is a subset of the space which contains exactly one point from each of these orbits . It serves as a geometric realisation for the abstract set of representatives of the orbits . There are many ways to choose a fundamental domain .

hope this help

7 0
3 years ago
What is 1 and 3/4 in grams?
Mice21 [21]
<span> 1 and 3/4 in grams is 
</span>1.75grams
8 0
3 years ago
Read 2 more answers
​_____ refers to​ internet-based platforms that allow users to create their own content and share it with others who access thes
liberstina [14]
This would be considered a social media platform due to it allowing people to share content.<span />
6 0
3 years ago
Ports that are generally used to establish outbound connections are known as ___ ports.
aivan3 [116]

Answer:

Ephemeral

Explanation:

3 0
4 years ago
You are the information security officer at a medium-sized company (1,500 employees). the cio asks you to explain why you believ
Ivahew [28]
If your CIO asks such a stupid question run for the hill, he should not hold that title.
Every company, small, medium or large should have Firewalls, Intrusion Detection, Managed Virus Protection Software at the very least. Windows is the most deployed OS in the world and of course the main target of hackers i.e Viruses. MAC's to a lesser extent and Unix while probably the least vulnerable are still not immune to Viruses/Trojan and other Malware.

Users can still be the victims of trojan horses, phishing scams, and other online fraud. There<span> is no such thing as a 100% safe computer, a </span>Mac<span>, Windows, and even Linux are all capable of being infected with a </span>virus<span> or other malware.
</span>
Lastly, physical access to any computer that is not encrypted is vulnerable.
5 0
3 years ago
Other questions:
  • QoS services are protocols that allow routers to make decisions about which IP datagram may be more important than others. Which
    13·1 answer
  • Which country does coriander come from
    11·2 answers
  • The central device on a network that provides a common connection point for nodes on that network is called the
    8·1 answer
  • Andrew works for a company that develops for a company that develops optic-fiber cables for transmission of data. which layer of
    14·1 answer
  • Assume we are testing a variable is_sunny in a while loop. is_sunny = “n”.
    13·1 answer
  • Animation timing is does not affect the
    10·1 answer
  • Robyn needs to ensure that a command she frequently uses is added to the Quick Access toolbar. This command is
    14·1 answer
  • Help on What i should say to my IT school lady? Read all three pages
    10·1 answer
  • Help ASAP please This is a skills lab simulation for college, it’s on Microsoft word is there a keyboard shortcut or something o
    12·1 answer
  • What method does a gsm network use to separate data on a channel?
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!