CodeSolved

Solved Programming Questions & Exercises

Average 2 pcs

Practice Easy 138/ Download 3552 Views Most popular

Write a program that receives two users and prints the mean on output

18 Answers

This answer is only visible to premium members
This answer is only visible to premium members
This answer is only visible to premium members
let msg = 'error'
alert(msg) 
This answer is only visible to premium members
This answer is only visible to premium members

This answer is only visible to premium members

Subscription is currently unavailable.
This answer is only visible to premium members
This answer is only visible to premium members
This answer is only visible to premium members
let msg = 'error'
alert(msg) 
This answer is only visible to premium members
This answer is only visible to premium members

This answer is only visible to premium members

Subscription is currently unavailable.
This answer is only visible to premium members
This answer is only visible to premium members
This answer is only visible to premium members
let msg = 'error'
alert(msg) 
This answer is only visible to premium members
This answer is only visible to premium members

This answer is only visible to premium members

Subscription is currently unavailable.
def calculate_average():
    # Receive two numbers from the user
    num1 = float(input("لطفاً عدد اول را وارد کنید: "))
    num2 = float(input("لطفاً عدد دوم را وارد کنید: "))
    
    # Calculate the mean
    average = (num1 + num2) / 2
    
    # Average printing
    print(f"میانگین دو عدد {num1} و {num2} برابر است با: {average}")

# Implementation of the function
calculate_average()
Mma123 Download Python
class Math:
	def __init__(self,num1,num2):
		self.num1=num1
		self.num2=num2	
	def Way(self):
		return (self.num1+self.num2)/2
num1=int(input("enrer your number1:"))
num2=int(input("enter your number2:"))
obj=Math(num1,num2)
print(obj.Way())
Roghaye.m Download Python
def cp(a,c):
    global s
    s = (a + c)/2
    print(s)
a = int(input("number1:"))
c = int(input("number2:"))
cp(a,c)
Hosien Download Python
def average(num1,num2):
    ave = (num1 + num2)/2
    return ave
a = float(input("number 1: "))
b = float(input("number 2: "))
print("average is: ",average(a,b))
a=int(input( 'num:'))
b=int(input( 'num:'))
print(a+b)
Maryam.n Download Python
# Getting user input
number1 = float(input("Enter the 1st number: "))
number2 = float(input("Enter the 2nd number: "))

# Calculating the average
sum = number1 + number2
average = lambda: sum / 2
print(f"Average: {average()}")

User 4343 Download Python
def miyangin(n,m):
    c = (m + n) / 2
    return c
print(miyangin(m=int(input("enter your m:")),n=int(input("enter your n:"))))
Sumy.amiri Download Python
<< Previous page 1 2 Next page >>

Submit answer

Submitting answers is currently unavailable.

Related content

Detection using AI
×
×
Close