Ask the user to type in an integer greater than 50 and assign it to a variable called x. Write a program to calculate the sum of squares of positive integers. The loop should stop when the sum is greater than x. At the end of the loop print how many numbers were used to calculate the sum. For example, if x is 100, sum will be 91, and six numbers (1 to 6) were used to calculate sum.

Answers

Answer 1

Answer:

The solution in Python is as follows:

num = int(input("Number: "))

if num>50:

    sum = 0

    count = 0

    for i in range(1,num):

         count = count + 1

         sum = sum + i**2

         if sum > num:

              sum = sum - i**2

              count = count - 1

              break;

   

    print("Sum: "+str(sum))

    print("Numbers: "+str(count))

else:

    print("Number must be greater than 50")

Explanation:

The condition stated in the question do not conform with the example. The question says, the loop should stop when sum > x.

But:

When x = 100 and sum = 91, the program loop should not stop because 91 is not greater than 100.

However, I'll answer based on the example given in the question.

This prompts user for number

num = int(input("Number: "))

The following if condition is executed if number is greater than 50

if num>50:

This initializes sum to 0

    sum = 0

This initializes count to 0

    count = 0

The iterates through the inputted number (e.g. 100)

    for i in range(1,num):

This increases the count

         count = count + 1

This calculates the sum of square of the positive integer

         sum = sum + i**2

The following removes excess number from the sum

         if sum > num:

              sum = sum - i**2

              count = count - 1

              break;

This prints the calculated sum    

    print("Sum: "+str(sum))

This prints the count of number used

    print("Numbers: "+str(count))

The following is executed if user input is less than 50

else:

    print("Number must be greater than 50")


Related Questions

A drop light that does not allow any electrical parts to come in contact with the outer casing of the device is called a:

Answers

Answer:

The right answer is "Double insulated light".

Explanation:

Double insulated led is mostly a sophisticated type of natural light that does not necessitate a terrestrial or planetary correlation. These illuminations could be based on these metals, are indicated in the electrical protection environmental standards that now the construction workers comply with, and therefore are readily accessible about every bedroom.

All of the following are data providers included with .NET for accessing and manipulating data in databases, EXCEPT ____. Group of answer choices

Answers

Complete Question:

All of the following are data providers included with .NET for accessing and manipulating data in databases, EXCEPT ____.

Group of answer choices.

A. OLE DB

B. ODBC

C. SQL Server

D. Access

Answer:

D. Access

Explanation:

A database management system (DBMS) can be defined as a collection of software applications that typically enables computer users to create, store, modify, retrieve and manage data or informations in a database. Generally, it allows computer users to efficiently retrieve and manage their data with an appropriate level of security.

A data dictionary can be defined as a centralized collection of information on a specific data such as attributes, names, fields and definitions that are being used in a computer database system.

In a data dictionary, data elements are combined into records, which are meaningful combinations of data elements that are included in data flows or retained in data stores.

This ultimately implies that, a data dictionary found in a computer database system typically contains the records about all the data elements (objects) such as data relationships with other elements, ownership, type, size, primary keys etc. This records are stored and communicated to other data when required or needed.

Basically, when a database management system (DBMS) receives data update requests from application programs, it simply instructs the operating system installed on a server to provide the requested data or informations.

Some examples of data providers included with .NET for accessing and manipulating data in databases are;

A. OLE DB: this is an acronym for Object Linking and Embedding Database. OLE DB was designed and developed by Microsoft corporation and it comprises of various application programming interfaces (APIs) used for data access.

B. ODBC: it is an acronym for Open Database Connectivity and it was designed and developed by Microsoft corporation used for data access through structured query language (SQL).

C. SQL Server: it is a domain-specific language server designed and developed for managing the various data saved in a relational or structured database.

The process of auditing the source code for an application to verify that the proper security controls are present, that they work as intended, and that they have been invoked in all the right places is known as

Answers

Answer:

Security code review.

Explanation:

The process of auditing the source code for an application to verify that the proper security controls are present, that they work as intended, and that they have been invoked in all the right places is known as security code review.

The main purpose of security code review is to ensure that all the necessary security measures or procedures are adopted (available), to confirm the level of accuracy of its operations, and verify that all loopholes for unauthorized access or use by attackers is prevented.

Hence, various software developers employ the security code review process in order to ensure that the integrity and safety of their software applications or programs are present.

Code review is the process for auditing the source codes and is a an application that is used for verification of the proper security control that are present and that they are intended to use.

The code review is to assure the quality of the software and verity the activity that checks the program mainly for viewing the parts of code.

Learn more about the source code for an application to verify that the

brainly.com/question/24749514.

Other Questions
Asphere has a radius of 27 inches. A horizontal plane passes through the center of the sphere.Part 1 out od 2Describe the cross section formed by the plane and the sphere. Luis solves the following system of equations by elimination.5s+ 3t = 302s+3t=-3What is the value of s in the solution of the system? Explain which has a greater impact on the kinetic energy of an object - the object's mass or the object's speed? .......guys please help me Kate and Rachel went out to lunch. Their bill came to $34.50 before the 6% sales tax. How much was their total bill with the tax? Stacy spins the pointer 120 times and records it. The pointer lands 30 times on a section numbered 2, 19 times on 3, 25 times on 4, 29 times on 5, and 17 times on 6. A winning spin is a 2. FIND THE EXPERIMENTAL PROBABILITY OF LANDING ON 2 Completes chauqe phrase a l'aide d'un partitif ou d'une expression de quantiteTu peux commander... di tu veux. HELPPP PLEASEEE ASAPP really need help i am failing these lessons Mali ran 21 miles in 3 hours. How many miles could she run in 5.5 hours?62.2 miles30 miles38.5 miles40.5 miles3. Solve the word problem using unit rates.Carl solves 12 multiplication problems for every 4 addition problems. If he solves 23 addition problems, how many multiplication problems does he solve?69 multiplication problems54 multiplication problems92 multiplication problems46 multiplication problems4. Find the fraction as percent.15%12%17%14%5. \Solve the proportions.4.2510896. Find the fraction as percent.0.7%70%0.07%7.0%7. 1. Zen Buddhism focuses on the nature of one's own mind and Tibetan Buddhism teaches actions that benefit all people, but both belong to which branch of thought?Theravada BuddhismHinduismMahayana BuddhismDaoism Please Help Asap). Read the passage. Then answer the questions 1 & 2: (Questions 1) How do Douglass's word choices contribute to the tone of the excerpt from Narrative of the Life of Frederick Douglass? Use evidence from the text to support your response. Your response should be at least two complete paragraphs. (Question 2) In the excerpt from Narrative of the Life of Frederick, how does Mr. Auld's decision to forbid his wife to teach Douglass to read change Douglass's viewpoint about his enslavement? Use evidence from the text to support your response. Your response should be at least two complete paragraphs. ( I will Mark Brainliest Need 2 answers please. Very important so please be honest . Need to pass this class. what is the difference between online school and in-personpls just write some down for a project thanks :) 6 of 12A car travels a distance of 180 km in a time of 3 hours.What is the car's average speed?km/h Could someone confirm if I was correct? You observe that the hair on your head stands up when a charged balloon is brought near without touching your head. Based on this observation, you write down the following question and steps to an experiment.Can two charged objects be attracted to each other without touching?Step #1: Bring the charged balloon 10 cm from your head.Step #2: Charge the balloon by rubbing it against a cloth.Step #3: Record your observation.Step #4: Bring the charged balloon 5 cm from your head.Step #5: Record your observation.What revision could you make to improve the experiment? Remove the fifth step, you do not need to make multiple observations in an experiment. Reverse the first two steps so that you charge the balloon before you bring it close to your head. Reverse the second and third steps so you record your observation before you charge the balloon. Swap steps two and four, you do not need to charge the balloon until the end of the experiment. 345 XPleaseee help meeee List 3 specific things you can do with a screw gun (not just screw in screws) In "My Life as a Bat," what are some of the main contrasts the narrator makes between humans and bats? What theme about people is developed through these contrasts? A bakery uses 300 pounds of flour to make 120 wedding cakes of the same size. At this rate how many pounds of flour are needed to make 1 wedding cake?Please answer the question Complete the factored form of the linear expression 21x + 14y = ( ) ( + )