Lab cycle2
Exercise 2:
Write
a program that asks the user to enter three numbers (use three separate input statements). Create variables called total
and average that hold the sum and average of the three numbers and print out the values of total and average.
Source Code:
number1 = int(input("Enter first number: "))
number2 = int(input("Enter secod number: "))
number3 = int(input("Enter third number: "))
total = number1 + number2 + number3
average = total/3
print("Sum of three numbers is:",total)
print("Average of three numbers
is:",average)
RESULT:
Enter first number: 5
Enter secod number: 4
Enter third number: 6
Sum of three numbers is: 15
Average of three numbers is: 5.0
Comments
Post a Comment