تمرین برنامه نویسی؛ با کدبزن!

منبع جامع سوالات و تمرینات برنامه نویسی

10
+1
+1
+1

محیط و مساحت دایره

پربازدید Mahdi آسان 71/ دانلود 9267 بازدید

برنامه ای بنویس که شعاع دایره را دریافت کند و مساحت و محیط آن را چاپ کند


مساحت دایره = شعاع * شعاع * عدد پی (3.14)

محیط دایره = قطر (شعاع*2) * عدد پی (3.14)

80 جواب

نمیتونم این تمرین رو حل کنم!
7
+1
+1
+1
from math import pi
r=int(input(("shoa'a: ")))
print(pi*r**2)
print(pi*r*2)
Ordinaryperson دانلود Python

great code کاربر 1738


3
+1
+1
+1
PI = 3.14
gh = float(input(' ghotr daiere ra vared konid : '))
sh = float(input('shoae daiere ra vared konid: '))

print('mohit:',PI * gh)
print('masahat',PI * sh * sh)
Adrin دانلود Python
2
+1
+1
r=input("shoa dayere ro vared con:")
r=float(r)
pi=3.14
pi=float(pi)
s=(r*r*pi)
print ("masahat dayeres=",s)
p=pi*r*2
print ("mohit dayere=",p) 
Mahdi دانلود Python
2
+1
+1
PI=3.14
r=float(input("shoa dayere: "))
s=r*r*PI
p=r*2*PI
print('masahat={}, mohit={}'.format(s,p)) 
Tamara دانلود Python
2
+1
+1
PI = 3.14 
r = float(input("shoae = "))
print("masahat= " , r**2 * PI)
print("mohit= " , r*2 * PI)
کاربر 714 دانلود Python
2
+1
+1
pi = 3.14
r = float(input('Shoae ra vared konid: '))
print('masahat dayere', (r*r*pi), 'ast')
print('mohit dayere', (r*2*pi), 'ast')
M3edixd دانلود Python
2
+1
+1
sh = float(input('sh:'))
p = 3.14
g = sh*sh
#  برابر است با قطر داره g
print(sh*sh*p)
print(g*p)
Mayoka دانلود Python
2
+1
+1
#تابع جهت محاسبه محیط و مساحت 
def dayere(INPUT):   
    #کاربر تعیین میکند عددی که وارد کرده قطر است یا شعاع تا آزادی عمل بیشتری داشته باشد
    witch_one= input('1.ghotr dayere 2.shoa dayere ? ')
    #اگر قطر رو انتخاب کنه در اینجا این شرط اجرا میشه 
    if witch_one =='1':
        mohit=INPUT*3.14
        #و در اینجا باید قطر رو تقسیم بر دو کنیم تا مساحت رو محاسبه کنیم 
        INPUT=INPUT/2
        masahat=INPUT*INPUT*3.14
    #اگر هم شعاع رو واردکرده باشه این شرط اجرا میشه و دیگه نیازی نیست ورودی تقسیم بر دو بشه 
    elif witch_one=='2':
        mohit=(2*INPUT)*3.14
        masahat=INPUT*INPUT*3.14
    #مقادیر محیط و مساحت رو فرمت میکنیم و در اینجا چاپ میکنیم 
    return f'masahat equal {masahat} and mohit epual {mohit}'
#محل دریافت ورودی و هندل کردن خطای احتمالی ولیو ارور 


try:
    INPUT=int(input('enter number (cm): '))
    #تابع در اینجا فراخوان میشود تا اگر مشکلی در ولیو ارور بود تابع اجرا نشود و برنامه پایان یابد
    print(dayere(INPUT))


except ValueError:
    #پیام خطایی که به کاربر داده میشود 
    print('---You probably used letters instead of numbers---')
Knowledgebiome دانلود Python
1
+1
r = float(input('r : '))
Pnumber = 3.14
p = (r * 2) * Pnumber
s = r * r * Pnumber
print('P : {}            S : {}'.format(p, s))

Astehal دانلود Python
1
+1
Shohah = float(input("Enter a number : "))
P = 3.14

print ("Masahat = {}      Mohit = {}".format(Shohah*Shohah*P , Shohah*2*P))
Kian1390 دانلود Python
1
+1
r=float(input(' enter shoae: '))
pi=3.14
masaht=r*r*pi
mohit=(r*2)*pi
print('masaht:',masaht)
print('mohit:',mohit)
Abtin67 دانلود Python
1
+1
PI = 3.14
r = float(input("enter r : "))

S = r * r * PI
print('masahat', S)

p = r * 2 * PI
print('mohit', p)
Hirbod87 دانلود Python
1
+1
pi = 3.14
sh = float(input("shoa dayere: "))
gh = float(input("ghotr dayere: "))
s = sh*sh*pi
p = gh*pi
print('masahat:', s)
print('mohit:', p)
کاربر 1034 دانلود Python
0
a = int (input('ent:'))
PI = int(3.14)
print ("mo:",a*2*PI,"ma:", float(pow(a,2))*PI , type(pow(a,2)*PI)) 
Pouriya دانلود Python
0
P = 3.14
while 1:
    def r(num):
        return "Area of ​​circle: " + str(num**2*P) + "\n" + "Perimeter of the circle: " + str(num*2*P)
    num = int(input("Enter the radius of the circle: "))
    if num == 0:
        break
    print(r(num))
Aryan84 دانلود Python

خیلی تو در توئه Aylin


خیلی ساده تر میشه نوشت خیلی پیچیده اش کردی Kian1390


0
adadpi=3.14
shoaa=float(input("shoaa:"))
masahat= (adadpi * shoaa *shoaa)
mohit=(shoaa * 2 *adadpi)
print("masahat" {} , "mohit" {} ) .format(masahat , mohit)
Amirowich دانلود Python
0
p = 3.14
r = float(input ("andaze shoa : "))
masahat = r*r*p
mohit = 2*r*p
print ("masahat :", masahat)
print ("mohit :" , mohit)
کاربر 300 دانلود Python
0
PI = 3.14
gh = float(input('ghotr daiere ra vared konid : '))
sh = float(input('shoae daiere ra vared konid: '))

print('mohit:',PI * gh)
print('masahat',PI * sh * sh)
Adrin دانلود Python
0
A=int(input('shoa'))
pi=3.14
print('mohit=' ,2*A*pi)
print('masahat=' ,pow(A,2)*pi)
Zb8319 دانلود Python
0
radius = int(input('Enter your a radius: '))
pi = 3.14

area = pi * (radius ** 2)
prime = pi * (radius * 2)

print(f'area circle is : {area}',
   f'prime circle is : {prime}')
Amir1 دانلود Python
0
p=3.14
sh=float(input('enter number :'))
sh1=float(input('enter number2 :'))
g=sh*sh1*p
print(g)

کاربر 443 دانلود Python
0
a=float(3.14)
c=float(input("R:"))
print(2*a*c)
print(a*c*c)
کاربر 448 دانلود Python
0
x = int(input())
print("masahat:", (x**2) * 3.14)
print("mohit", (x * 2) * 3.14)
Amirhossein دانلود Python
0
r=int(input("radius: "))
masahat=(r*r)*3.14
mohit=(r*2)*3.14
print("masahat: ",masahat)
print('mohit: ',mohit)
Mahan78 دانلود Python
0
Radius = input("Enter Circle Radius :")
Radius = float(Radius)
P = 3.14
Environment = (Radius*2)*P
Area = Radius*Radius*P
Sentece1 = f'Environment is {Environment}'
Sentece2 = f'Area is {Area}'
print(Sentece1)
print(Sentece2)
Taha1390 دانلود Python

کد قشنگیش به سادگیشه و اینکه کوتاه باشه و خوانا... میتونستی خط اولو دومو خیلی ساده تر بنویسی . مثلا: Radius = float(input("enter circle Radius:")) Aylin


0
radius = input("Please enter circle radius: ")
P = 3.14
if radius.isdigit():
    areaOfCircle = (int(radius) ** 2) * P
    perimeterOfTheCircle = (int(radius) * 2) * P
    print(f"Area of circle: {areaOfCircle:.2f}\n"
          f"Perimeter of the circle:{perimeterOfTheCircle:.2f}")
else:
    print('\nThe input is invalid, Please try again')
Rauf1399 دانلود Python
0
a=int(input("shoae:"))
PI=3.14
b=(a*a*PI)
c=(a+a)
d=(c*PI)
print("mohit:",d,"masahat:",b)
کاربر 638 دانلود Python
0
r = int(input("shoa dayere: "))
masahat = r * r * 3.14
mohit = r * 2 * 3.14
print("masahat dayere = ", masahat)
print("mohit dayere = ", mohit)
Red003 دانلود Python
0
Shoae = int(input("shoae ra vared konid")
print(shoae * shoae * 3.14)
کاربر 763 دانلود Python
0
r = int (input("enter r :"))
#r=شعاع
pi = 3.14
p = 2*r*pi
s = pi*r**2
print("p:" ,p, end=("/"))
print("s:" ,s)
Aylin دانلود Python
0
a=float(input("shoae dayere : "))
print ("masahat=",a*a*3.14)
print ("mohit=",a*2*3.14)
کاربر 867 دانلود Python
0
while True:
    radius = int(input("enter the radius: "))
    diameter = radius * 2
    pynumber = 3.14
    print(f"perimeter is: {2 * pynumber * radius} ")  
    print(f"Area is: {pynumber * (radius**2)} ")  
کاربر 812 دانلود Python
0
int pI = (int)3.14;
Console.WriteLine("Please Enter Radius Size :");
int Radius=Convert.ToInt32(Console.ReadLine());

int arrayCircle = Radius * Radius * pI;
int perimeterCircle = (Radius*2) * pI;

Console.ForegroundColor = ConsoleColor.Red;
Console.WriteLine($"perimeter of the circle is : {perimeterCircle} ,Area of ​​circle is : {arrayCircle} ");

Console.ReadKey();
Alifasihi دانلود C#
0
a = int(input("شعاع : "))
h= (a,a)
c=sum(h)
m=(3.14)
b =((c*m))
k=(a*a*m)
print(b),("mohit : ")
print(k),("masahat : ")
کاربر 961 دانلود Python
0
let pi = 3.14;
 let radius = prompt("Enter radius:");
 area = radius * radius* pi;
 environment = radius * 2 * pi;
 console.log(area + ":مساحت دایره هست ");
 console.log(environment + ":محیط دایره هست ");
کاربر 1009 دانلود JavaScript
0
a = int(input("shoa ra vared konid: ")
PI = 3.14

print(f'''mohit daiere {a*2*PI} ast.
masahat daiere {a**2*PI} ast.''')
Kiachetore دانلود Python
0
 while 1:
    x=str(input("1.mohit 2.masahat\n"))
    if x=="1":
        m=int(input("r dayre ra varid konid : "))    
        mohit=(m*2*3.14)
        print(mohit)
    if x=="2":
        m=int(input("r dayre ra varid konid : "))
        masahat=(m*m*3.14)
        print(masahat)
کاربر 1156 دانلود Python
0
P = 3.14
r = float(input('r:'))
print('masahat=',P*r*r)
print('mohit=',P*r*2)
کاربر 1211 دانلود Python
0
r=float(input("beam: "))
print( 3.14 * r * r )
i = r + r 
print ( i * 3.14 ) 
کاربر 1148 دانلود Python
0
x = int(input('sho a ra vared konid : '))

masahat = x * x * 3.14
mohit = (x * 2) * 3.14

print(f'mashat {masahat} va mohit {mohit}')
کاربر 1224 دانلود Python
0
x = int(input('sho a ra vared konid : '))

masahat = x * x * 3.14
mohit = (x * 2) * 3.14

print(f'mashat {masahat} va mohit {mohit}')
کاربر 1224 دانلود Python
0
a = int(input("r: "))
pi = 3.14
print("mohit :"  2 * a * p)
print("masahat :" a*a*p)
کاربر 1231 دانلود Python
0
import math
class Circle:
    def __init__(self,r:int = 0):
        self.r = r
    def GetInfo(self):
        self.r = int(input('Enter r ='))
    def Area(self):
        return round(math.pow(self.r,2) * round(math.pi,2),2)
    def Perimeter(self):
        return round(2 * self.r * round(math.pi,2),2)
obj = Circle()
obj.GetInfo()
print(f'perimeter = {obj.Perimeter()}\narea = {obj.Area()}')
کاربر 1232 دانلود Python
0
π = 3.14

# area = radius * radius * π

def area():
    radius = float(input("Enter radius:"))
    area = radius * radius * π
    print(f"area of the circle equals to-->: {area}")

# perimeter = diameter(radius *2) * π

def perimeter():
    diameter = float(input("Enter radius:"))
    perimeter = (diameter*2) * π
    print(f"perimeter of the circle equals to-->: {perimeter}")

area()
perimeter()
Javadmirjalili دانلود Python
0
val shoeae = readLine()!!.toInt()
val mesahet = shoeae*shoeae*PI
val mohit = (shoeae*2)*PI
println("mesahet = $mesahet")
println("mohit = $mohit")
کاربر 1279 دانلود Kotlin
0
x = float(input('شعاع :'))
p = 3.14


b = x*x*p
y = (x+x)*p


print('مساحت:',b)
print('محيط :',y)
کاربر 1280 دانلود Python
0
x=int(input("shoaa"))
y=int(input("ghotr"))
pi=3.14
print("mohit",pi*y)
print("masahat",pi*x*x)
کاربر 1168 دانلود Python
0
P = 3.14
shoa = float(input("shoa.a: "))
print('masahat: ',(shoa*shoa)*P)
print("------------------")
print("mohit:",(shoa*2)*P)
کاربر 1324 دانلود Python
0
r = int(input("shoa:  "))
π = 3.14
print("mohit = " , π*r*2)
print("masahat = " , π*r**
کاربر 1388 دانلود Python
0
r = int (input("r="))
s = r**2*3.14
p = r*2*3.14
print ("s=", s)
print ("p=",p )
کاربر 1393 دانلود Python
0
double a , masahat , mohit;
cin>>a;
mohit=(a*2)*3.14;
masahat=a*a*3.14;
cout<<masahat<<endl<<mohit;
}
کاربر 1408 دانلود C++
0
r = int(input("Enter the r: "))

Pi = 3.14
ghotr = r * 2
s = r * r * Pi
p = ghotr * Pi

print(f"masahat{s}, mohit:{Pi}")
کاربر 1418 دانلود Python
0
r = int(input("Enter the radius: "))

Pi = 3.14

s = (r * r) * Pi
p = (r * 2) * Pi

print(s, p)
کاربر 1418 دانلود Python
0
a = float (input ("Shoae Dayere= "))

print ("Masahat=" , a*a*3.14)
print ("Mohit=" , a*2*3.14)
Alikhosravi9775 دانلود Python
0
r = int(float(input('r:)))
p=3/14
masahat=r * r * p
mohit=r * 2 * p

print(masahat)
print(mohit)
کاربر 755 دانلود Python
0
radius = float(input("radius?"))
pi = 3.14
area = radius * radius * pi
print("radius * radius * pi = area ")
print("area:" , area)
Drake2024 دانلود Python
0
r = int(input('how many is your circle radius : '))

# محیط 
print ("environment = {}" .format(r*2*3.14))
# مساحت
print ("area : {}".format(r*r*3.14))
کاربر 1652 دانلود Python
0
r =int (input('give me Radius:'))
pi = 3.14
if r >= 0:
  perimeter = 2 * pi * r
  area = pi * r ** 2print(f'Area of circle: {area}\n', f'Perimeter of the circle: {perimeter}')
else:
  print('Please try again')
کاربر 1666 دانلود Python
0
sh = int(float(input("sh: ")))
print( "mohit", sh * sh * 3.14)
print("macahat ", sh *2 * 3.14)
Amirhosein دانلود Python
0
def circleArea(radius,numberPI='3.14'):
    area = radius * radius * (numberPI)
    print(area)

circleArea(5,3.14)


def circumference(radius,numberPI='3.14'):
    circumference = radius ** 2 * numberPI
    print(circumference)

circumference(5,3.14)
Rezaeikhanghah دانلود Python
0
radius= float(input('shoae daiere : '))
PI= 3.14

mohit= 2*PI*radius
masahat= PI*radius**2

print('agar π = 3.14\nmohite daiere : {}\nmasahate daiere : {}'.format(mohit,masahat))
Soheyl دانلود Python
0
 R =int and float(input("R ra vared konid :"))
 masahat = R*R*3.14
 Q = R+R
 mohit = Q*3.14
 print("masahat : ",masahat)
 print("mohit : ",mohit)
کاربر 1738 دانلود Python
0
a=int(input('enter shoa:'))
print('masahat' , a*a*3.14)
b=a+a
print('mohit' , b*3.14)
کاربر 1804 دانلود Python
0
Radius = int(input("radius of a circle:"))
print(Radius * Radius * 3.14) ; print(Radius * 2 * 3.14)
کاربر 1736 دانلود Python
0
let radius = parseFloat(prompt("لطفا شعاع دایره را وارد کنید:"));
let area = Math.PI * radius * radius;
let circumference = 2 * Math.PI * radius;

console.log("مساحت دایره: " + area);
console.log("محیط دایره: " + circumference);
Admin دانلود JavaScript
0
s = float(input("shoaye dayere:    "))
s = (print(float(s*s*3.14)))
کاربر 1916 دانلود Python
0
r=float(input(" Enter a number for circle ..."))
print(" masahat={} , mohit={} ".format(r**2*3.14,(r*2)*3.14))
کاربر 1951 دانلود Python
0
name = int(input("showa dayere: "))
result = name*2
print(result*3.14)
کاربر 1964 دانلود Python
0
const x = prompt("please Enter Radius: ")
const pi = 3.14;
const areaTheCircle = x ** 2  * pi;
const aroundCircle = x * pi;
console.log(areaTheCircle);
console.log(aroundCircle);
کاربر 1937 دانلود Python
0
#include <iostream>
using namespace std;
int main(){
    int a;
    cout << "Input radius: ";
    cin >> a;
    cout << "Area: " << 2 * a * 3.14 << endl;
    cout << "Circumference: " << a * a * 3.14;
}
Yazdan دانلود C++
0
a=float(input("shoaa:"))
b=float(a*2)
p=float(3.14)
print("masahat:",(a*a*p))
print("mohit:",(b*p))
کاربر 1991 دانلود Python
0
s = float(input("s:"))
m = (s * s * 3.14)
print(m)
n = (s * 2)
f = (n * 3.14)
print(f)
کاربر 2043 دانلود Python
0
<?php


define('PI', 3.14);


$radius = 5; // This Is Input From User
$unit = 'cm';


$diameter = $radius * 2;
$environment = $diameter * PI;
$area = $radius * $radius * PI;
$pi = PI;        


$result = <<< RESULT
        
The Radius Is : $radius $unit
The Diameter Is : $diameter $unit


And Results :
    
Env = ( Diameter  * PI  ) =
      ( $diameter * $pi ) =
        
      $environment $unit
        
        
Area = ( Radius * Radius * PI  ) =
      ( $radius * $radius * $pi ) =
        
      $area square $unit
        
RESULT;
        
echo '<pre>';
echo $result;
echo '<pre>';
Kian90 دانلود php
0
a=float(input('namber:'))
s=a*a*3.14
d=a*2*3.14
print(f"Msahat dayere:{s}")
print(f"mhit dayere:{d}")
کاربر 2019 دانلود Python
0
from math import pi

s = int(input("Enter the radius of the circle."))

print(s*s*pi)

print (s*2*pi)
Khorshid دانلود Python
0
from math import pi


s = int(input("Enter the radius of the circle."))
print("Area of circle= " , s*s*pi)
print ("Perimeter of the circle = " , s*2*pi)

Khorshid دانلود Python
0
#این کد برای  محسابه محیط و مساحت دایره می باشید
A = float(input ('Enter sh=' ))
B = (A * 2 * 3.14)
C = (A * A * 3.14)
print('S=', B , 'P=',C)


Nicola دانلود Python
0
shoa=float(input("shoa ra vared konid: "))
print('masahat { }, mohit{ }. format(shao*shoa*3.14 ,shoa*2*3.14
کاربر 2121 دانلود Python
0
r = float(input('r: '))
PI = 3.14
masahat = r * r * PI
mohit = r * 2 * PI
print(mohit)
print(masahat)
Ilya09 دانلود Python
0
import math
shoa=float(input("shoa="))
mohit=2*shoa*math.pi
masahat=shoa*shoa*math.pi
print("mohit=",mohit)
print("masahat=",masahat)
Alireza949 دانلود Python

ارسال جواب

/* کداتو توی این بخش بنویس
فرقی نمیکنه چه زبان برنامه نویسی باشه، همرو پشتیبانی میکنیم :)
البته قبلش این سه خط رو پاک کن */


  • تو جوابت میتونی از تصویر، کد، لینک به سایر صفحات و... استفاده کنی
  • لطفا جواب های تکراری ارسال نکن
  • جواب های ارسالی، پس از بررسی کوتاهی، ویرایش میشن و در سایت نمایش داده میشن
  • ارسال جواب حق مادی یا معنوی برای ارسال کننده ایجاد نمیکند و تمام حقوق برای سایت کدبزن محفوظ است

تمرینات مرتبط

تشخیص با استفاده از هوش مصنوعی
×
×
بستن