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

محاسبه مساحت مستطیل

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

برنامه ای بنویسید که طول و عرض مستطیلی را از ورودی دریافت کند و مساحت آن را در خروجی چاپ کند

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

پاسخ‌ها 139

;کد
a=int(input("Tool Mostatil ra vared konid :"))
b=int(input("Arze Mostatil ra vared konid :"))
print("Masahat Mostatil barabar ast ba:", a*b, "m2")
جواب
Tool Mostatil ra vared konid :15
Arze Mostatil ra vared konid :4
Masahat Mostatil barabar ast ba: 60 m2

lenght, width = [float(x) for x in input("Enter rectangle's lenght and width (seperated with ','): ").split(',')]
print(f"The area of ​​a rectangle with length {lenght} and width {width} is equal to {lenght * width}")
package Tax.App;
import java.util.Scanner;

public class S_Rectangle {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        try {
            System.out.print("please enter tool: ");
            int tool = sc.nextInt();
            System.out.print("please enter ars: ");
            int ars = sc.nextInt();
            if (ars>0 && tool>0&&tool>ars) {
                System.out.println(tool+" x "+ars+" = "+tool*ars);
            }else
                System.out.println("please enter valid number");

        }catch (Exception e) {
            System.out.println("please enter valid number");
        }
    }
}

ارسال جواب

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

مطالب مرتبط

auto_awesome به تشخیص هوش مصنوعی
×
بستن