Answer:
1. Select below the row where you want the split, or the column to the right of where you want the split.
2. On the View tab, in the Window group, click Split.
Explanation:
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.
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")