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
Management of software development consist of?
JulsSmile [24]

Answer:

d. All of the above

Explanation:

A software can be defined as a set of executable instructions (codes) or collection of data that is used typically to instruct a computer how to perform a specific task and to solve a particular problem.

A software development life cycle (SDLC) can be defined as a strategic process or methodology that defines the key steps or stages for creating and implementing high quality software applications.

In Computer science, management of software development consist of;

a. Process: it involves the stages through which a software application is analyzed, designed, developed, tested, etc.

b. People: it refers to the individuals involved in the software development process.

c. Project: it's the entirety of the stages a software goes through before it gets to the end user.

5 0
3 years ago
Jeremy wishes to create a site map for his website. What tag will surround the URL of his home page?
Inga [223]

Answer:

C. <loc>

Explanation:

We need to mention the below details:

  • location
  • changed frequency
  • last changed
  • priority of page

We have the XML file for a sitemap, and we need to enter the above details for each of the Url. We need to enter the location, last changed, changed frequency and priority of the page for each of the URLs. And the URL of the home page is surrounded by the Loc tag. And hence, the correct option for this post is the C.<Loc> option.

8 0
3 years ago
True or False
steposvetlana [31]

Answer:

1. False

2. False

3. True

4. False

Explanation:

1. Folders are the containers to store files

2. The delete option deletes the file

3. Files are moved to recycle bin after being deleted, and can be permanently deleted from recycle bin

4. "MS-DOS was the main operating system for IBM PC compatible personal computers during the 1980s, from which point it was gradually superseded by operating systems offering a graphical user interface (GUI), in various generations of the graphical Microsoft Windows operating system."

<em>source for #4: Wikipedia</em>

3 0
3 years ago
Sending a busy manager a long email represents a problem in which area of the communication process
FromTheMoon [43]
Time management,they wouldn’t have enough time to read it and they would become more stressed out
3 0
3 years ago
In a typical e-mail address, the "host" is user: which one of the following word processing features saves you the most time whe
gayaneshka [121]
Find-and-replace . hope this helps !
4 0
3 years ago
Other questions:
  • The ____ operation is used to add an element onto the stack.
    15·1 answer
  • . _______ are the components that allow a posi-traction differential to transfer power from one drive wheel to another.
    10·1 answer
  • What are some fun games to play on you phone?
    12·2 answers
  • List at least three benefits of automated testing?
    13·1 answer
  • Your organization's network has multiple layers of security devices. When you attempt to connect to a service on the Internet. H
    9·1 answer
  • When classified data is sent over an unclassified network, what is this incident called?
    5·1 answer
  • In this lab you will learn about the concept of Normal Forms for refining your database design. You will then apply the normaliz
    15·1 answer
  • How does Shakespeare immediately introduce Tybalt as a menacing character?
    9·1 answer
  • 1. Create an optimized function "print s(n,s)" that prints the given argument s (representing a string) k times. k represents th
    7·1 answer
  • he wants to customize the operating system to meet his needs. what types of tools should he use, and what can he do with each?
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!