حالت آفلاین — محتوا از حافظهٔ کش نمایش داده می‌شود
همهٔ تمرین‌ها

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

تمرین آسان 16418 visibility link download flag trending_up پربازدید

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


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

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

👨‍💻 1 ساعت قبل کاربر ناشناس این تمرین رو مشاهده کرد

پاسخ‌ها 71

Document const r = parseFloat(prompt("لطفاً شعاع دایره را وارد کنید:")); if (!isNaN(r)) { const mohit = 2 * Math.PI * r; const masahat = Math.PI * Math.pow(r, 2); alert(`محیط دایره: ${mohit.toFixed(2)}\nمساحت دایره: ${masahat.toFixed(2)}`); } else { console.log("مقدار وارد شده عدد نیست."); }
#===(1)
def circle(r):
    p = 3.14
    mohit = 2 * p * r
    print(mohit)
    masahat = (r ** 2) * p
    print(masahat)
print(circle(r=float(int(input("enter your r:")))))
#===(2)
r = int(input("enter your number:")) 
p = 3.14
mohit = 2 * p * r
masahat = r * r * p
print(mohit)
print(masahat) 
def arae_invironment_circel():
    """
    این تابع مساحت و محیط دایره را نشان میدهد
    """
    radius =int(input("please enter the radius :"))
    area = (radius*radius)*3.14
    environment = (radius*2)*3.14
    return f"area : {area} \nenvironment : {environment:.2f}"
print(arae_invironment_circel())
        <script>
            let R = prompt("Enter the radius of the circle:");
            const PI = 3.14;
            let area = PI * R**2;
            let circumference = 2 * PI * R;
            document.writeln(`Area of the circle: ${(area).toFixed(2)} <br> Circumference of the circle: ${(circumference).toFixed(2)}`);
        </script>
def area_circumference(x):
    return (x**2)*3.14, (x*2)*3.14
redius=float(input("enter the redius of circle>>>"))
area, circumference=area_circumference(redius)
print("area---->",area,"\ncircumference----->",circumference)
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>circl radius</title>
</head>
<body>
    <script>
        function circle_radius(){
            var radius=prompt('inter the radius:');
            circl_setting=radius*3.14*2
            circle_area=radius*radius*3.14
            console.log(circl_setting,circle_area)
        }
        circle_radius()
    </script>
</body>
</html>

ارسال جواب

جوابت را با Markdown بنویس و ثبت کن

×
بستن