vvide198 vvide198
  • 19-02-2021
  • Computers and Technology
contestada

Can somebody help me and make a code for this in PYTHON, please? I would be very thankful!

Find sum of the first n even numbers.
Without using formula (n*(n+1)).

Respuesta :

sambhavrishi
sambhavrishi sambhavrishi
  • 19-02-2021

Answer:

number = int(input())

x = 0

y = 0

for n in range(number):

if n % 2 == 0:

x += n

else:

y += n

print(x)

print(y)

Answer Link

Otras preguntas

A rectangle with dimensions of 3 units by 5 units is enlarged by a scale factor of 1.4 By what percent does its area increase?
7 7/12 + (3 1/2 + 1 7/8)
Mr. Tom gives $30 to Bailey and Jenny. If Bailey gets twice as much money as Jenny how much will Jenny get?
Christy drove 270 miles in 6 hours at a constant speed how long would it take her to drive 405 miles at the same speed ?
what is 12/21 reduced to
Two angles are supplementary. One angle is 5* less than four times the other find the measures of the angles
mr. smith is on a trip.on the first day he travelled 2/5 of the trip, and on the second day he travelled another 1/3. what fraction of thw trip did he travel in
how are continental glaciers and valley glaciers different?
How do you estimate 3/4 - 1/8?  How much of 3/4 is left?
Why were enlightenment ideas never fully practiced by eighteenth century rulers