محاسبه مساحت مستطیل
برنامه ای بنویسید که طول و عرض مستطیلی را از ورودی دریافت کند و مساحت آن را در خروجی چاپ کند
👨💻 1 ساعت قبل کاربر ناشناس این تمرین رو مشاهده کرد
برنامه ای بنویسید که طول و عرض مستطیلی را از ورودی دریافت کند و مساحت آن را در خروجی چاپ کند
tool = float (input("tool:"))
arz = float (input("arz: "))
masahat = tool * arz
print("masahat",masahat)
tul = int(input('enter a tul: '))
arz = int(input('enter a arz: '))
print('masahat:', tul * arz)
m = int(input("age:"))
n = int(input('age:'))
b = (n*m)
print(b)
arz = float(input("عرض: "))
tool = float(input("طول: "))
masahat = tool * arz
print("مساحت =", masahat)
a = float(input("Enter tool"))
b = float(input("Enter arz"))
print(a * b)
a = int(input('write the height: '))
b = int(input('write the width: '))
c = (a * b)
print('your S is: ', c)
;کد
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 بنویس و ثبت کن
برای استفاده از این بخش باید وارد حساب کاربریت بشی
ورود/ثبت نامتوضیح کوتاهی بنویسید تا تیم بررسی کند.