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
katrin [286]
3 years ago
13

Write a program that accepts a positive integer N as command-line argument, and outputs True if N is the square of some integer,

and False otherwise. Do not use math.sqrt() or similar! Hint: Clearly, all candidates i which may satisfy i2 = N must be at most N (for which "corner case" of N is i equal to N?). Therefore, it is sufficient to check if there exists an i in the range 1 ≤ i ≤ N such that i2 = N. In other words, you want to evaluate the expression (12 == N)or (22 == N)or (32 == N)or ··· or ((N − 1)2 == N) or (N2 == N). Practice goal: A variation of the primality checking program we have seen in class; follows a Boolean accumulation pattern, with logical or.
Computers and Technology
1 answer:
Ann [662]3 years ago
3 0

Answer:

In Python:

N = int(input("Positive integer: "))

if N > 0:

   flag = False

   for i in range(1,N+1):

       if i * i == N:

           flag = True

           break

   print(str(flag))

else:

   print("Positive integer only")

   

Explanation:

N = int(input("Positive integer: "))

If the number is positive

if N > 0:

This initializes a boolean variable to false

   flag = False

This iterates from 1 to the input integer

   for i in range(1,N+1):

This checks if th number is a square of some integer

       if i * i == N:

If yes, flag is set to true

           flag = True

The loop is exited

           break

This prints either true or false, depending on the result of the loop

   print(str(flag))

If otherwise, that the number is not positive

<em>else:</em>

<em>    print("Positive integer only")</em>

You might be interested in
Glenda operates an Airbnb business in which she rents her apartment for $150us per night. There is a mandatory deposit of $50 do
inysia [295]

Answer:

Explanation:

There would be allaround 30 on the side.

8 0
3 years ago
____ of risk is the choice to do nothing to protect an information asset and to accept the outcome of its potential exploitation
umka21 [38]

Answer:

b. Acceptance

Explanation:

<em>"Acceptance </em><em>of risk is the choice to do nothing to protect an information asset and to accept the outcome of its potential exploitation.  </em><em>"</em>

<em>Acceptance Control </em>is important as a strategy when an organization has accomplished a determined level of risk, or it has estimated potential damages that might happen due to attacks, or the organization has developed a thorough analysis related to cost benefits, or it has also evaluated the probabilities of attacks.

7 0
3 years ago
You have been tracking your exercise routine, which involves running, lifting weights, yoga, and stretching. You want to see wha
Harrizon [31]

The best chart to see the data distribution for the exercise routine would be a pie chart. Using Microsoft Excel, you can input each data point you have for all you exercise routine category, and generate a pie chart which will show you the percentage for each category in comparison to the total.


5 0
3 years ago
Read 2 more answers
Why is it important to increase componentization and standardization?
liraira [26]
Jiskha help me with something similar with
8 0
3 years ago
Which organization has published more than 300 Web standards, and encourages manufacturers to follow these standards, many of wh
jek_recluse [69]

Answer:

c

Explanation:

6 0
3 years ago
Other questions:
  • 1. Which markup language adds the ability to use video without requiring the user to download add-ons?
    13·1 answer
  • Melissa is the network administrator for a small publishing company. as network administrator, she is in charge of maintaining t
    8·1 answer
  • What is another name for “low-angle lighting”?
    7·1 answer
  • "As a ____ database management system, Access is particularly powerful because you can enter data once and then retrieve informa
    6·1 answer
  • Today when Dylan turned on his computer, he noticed that the monitor was very dim. He could still see the desktop icon and text.
    15·1 answer
  • Problem: Mr. James Reid, the director of admissions at MOGCHS University, has
    14·1 answer
  • User defined blocks of code can be created in
    13·1 answer
  • Why do you usually find domain names instead of IP addresses in a URL? Select one: a. An IP address would make your web page loa
    11·1 answer
  • What form of contacts can be shared in Outlook 2016?
    9·2 answers
  • What do you think that the next version of IR (IR 5.0) will bring if it was discovered in near future? (hint:- advance IR 4.0 fe
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!