Write a python program to calculate the sum and average of first 10 numbers.

                                            Write a python program to determine whether a person is eligible to vote.

Write a python program to calculate the sum and average of first 10 numbers.

PROGRAM:

 # The sum of n numbers= n(n+1)/2

# The average of n numbers= sum of n numbers/n

n=10

b=(n*(n+1))/2

print("The sum of first 10 numbers: ",b)

print("The average of first 10 numbers:",b/n)

OUTPUT:

The sum of first 10 numbers:  55.0
The average of first 10 numbers: 5.5

No comments:

Post a Comment




Copyright Ⓒ 2022 | Mechpedia | All Right Reserved.