Làm thế nào để bạn tìm thấy chu vi của một hình chữ nhật trong python?


Chiều dài và chiều rộng của hình chữ nhật và bán kính của hình tròn được nhập thông qua bàn phím. Viết chương trình tính diện tích & chu vi hình chữ nhật, diện tích & chu vi hình tròn l * b 2(l+b) πr2 2πr


Mã nguồn

'''
Area of Rectangle=l*b
Perimeter of Rectangle=2*(l+b)
Area of Circule=PI*r*r(PI=3.14)
Circum of a Circule=2*PI*r
'''
len=int(input("Enter the Lenth of rectangle:"))
bre=int(input("Enter the Breadth of rectangle:"))
r=int(input("Enter the Redius of Circle:"))
area1=len*bre
perimeter=2*(len+bre)
area2=3.14*r*r
circum=2*3.14*r
print("Area of Rectangle =",area1)
print("Perimeter of Rectangle =",perimeter)
print("Area of Circle =",area2)
print("Circum of Circle =",circum)

đầu ra

Enter the Lenth of rectangle:10
Enter the Breadth of rectangle:12
Enter the Redius of Circle:23
Area of Rectangle = 120
Perimeter of Rectangle = 44
Area of Circle = 1661.06
Circum of Circle = 144.44


Để tải file raw Bấm vào đây

Chương trình tìm Chu vi/Chu vi hình vuông, hình chữ nhật

Cải thiện bài viết

Lưu bài viết

Thích bài viết

  • Cập nhật lần cuối. 21 tháng 6 năm 2022

  • Đọc
  • Bàn luận
  • khóa học
  • Luyện tập
  • Băng hình
  • Cải thiện bài viết

    Lưu bài viết

    Chu vi của một hình bằng tổng độ dài các cạnh. Để tính chu vi hình vuông cần độ dài một cạnh vì các cạnh đều bằng nhau. Muốn tính chu vi hình chữ nhật cần biết chiều dài, chiều rộng hình chữ nhật.
    Chu vi hình vuông.
     

    Làm thế nào để bạn tìm thấy chu vi của một hình chữ nhật trong python?

    Chu vi hình vuông được tính theo công thức.
     

    C = 4 * a
    where a is the side length.

    Ví dụ.
     

    input: 4
    output: 16
    
    input: 3
    output: 12

     

    C++




    input: 4
    output: 16
    
    input: 3
    output: 12
    93

    input: 4
    output: 16
    
    input: 3
    output: 12
    94

    input: 4
    output: 16
    
    input: 3
    output: 12
    95

    input: 4
    output: 16
    
    input: 3
    output: 12
    96
    input: 4
    output: 16
    
    input: 3
    output: 12
    0
    input: 4
    output: 16
    
    input: 3
    output: 12
    1

     

    input: 4
    output: 16
    
    input: 3
    output: 12
    2
    input: 4
    output: 16
    
    input: 3
    output: 12
    3
    input: 4
    output: 16
    
    input: 3
    output: 12
    2
    input: 4
    output: 16
    
    input: 3
    output: 12
    5

    input: 4
    output: 16
    
    input: 3
    output: 12
    6

    input: 4
    output: 16
    
    input: 3
    output: 12
    7
    input: 4
    output: 16
    
    input: 3
    output: 12
    8
    input: 4
    output: 16
    
    input: 3
    output: 12
    9

    Enter the Lenth of rectangle:10
    Enter the Breadth of rectangle:12
    Enter the Redius of Circle:23
    Area of Rectangle = 120
    Perimeter of Rectangle = 44
    Area of Circle = 1661.06
    Circum of Circle = 144.44
    
    
    40

     

    Enter the Lenth of rectangle:10
    Enter the Breadth of rectangle:12
    Enter the Redius of Circle:23
    Area of Rectangle = 120
    Perimeter of Rectangle = 44
    Area of Circle = 1661.06
    Circum of Circle = 144.44
    
    
    41

    input: 4
    output: 16
    
    input: 3
    output: 12
    2
    Enter the Lenth of rectangle:10
    Enter the Breadth of rectangle:12
    Enter the Redius of Circle:23
    Area of Rectangle = 120
    Perimeter of Rectangle = 44
    Area of Circle = 1661.06
    Circum of Circle = 144.44
    
    
    43

    input: 4
    output: 16
    
    input: 3
    output: 12
    6

    input: 4
    output: 16
    
    input: 3
    output: 12
    7____32
    Enter the Lenth of rectangle:10
    Enter the Breadth of rectangle:12
    Enter the Redius of Circle:23
    Area of Rectangle = 120
    Perimeter of Rectangle = 44
    Area of Circle = 1661.06
    Circum of Circle = 144.44
    
    
    47

    input: 4
    output: 16
    
    input: 3
    output: 12
    7____149
    C = 4 * a
    where a is the side length.
    40

    ________ 241 ________ 242 ________ 243

    C = 4 * a
    where a is the side length.
    41
    C = 4 * a
    where a is the side length.
    45

    input: 4
    output: 16
    
    input: 3
    output: 12
    7
    input: 4
    output: 16
    
    input: 3
    output: 12
    8
    C = 4 * a
    where a is the side length.
    48

    Enter the Lenth of rectangle:10
    Enter the Breadth of rectangle:12
    Enter the Redius of Circle:23
    Area of Rectangle = 120
    Perimeter of Rectangle = 44
    Area of Circle = 1661.06
    Circum of Circle = 144.44
    
    
    40

     

    input: 4
    output: 16
    
    input: 3
    output: 12
    40

    input: 4
    output: 16
    
    input: 3
    output: 12
    41

    Java




    input: 4
    output: 16
    
    input: 3
    output: 12
    42

    input: 4
    output: 16
    
    input: 3
    output: 12
    94

     

    input: 4
    output: 16
    
    input: 3
    output: 12
    44
    input: 4
    output: 16
    
    input: 3
    output: 12
    45

    input: 4
    output: 16
    
    input: 3
    output: 12
    46
    input: 4
    output: 16
    
    input: 3
    output: 12
    47

    input: 4
    output: 16
    
    input: 3
    output: 12
    6

    input: 4
    output: 16
    
    input: 3
    output: 12
    7
    input: 4
    output: 16
    
    input: 3
    output: 12
    2
    input: 4
    output: 16
    
    input: 3
    output: 12
    3______32
    input: 4
    output: 16
    
    input: 3
    output: 12
    5

    input: 4
    output: 16
    
    input: 3
    output: 12
    7
    input: 4
    output: 16
    
    input: 3
    output: 12
    6

    input: 4
    output: 16
    
    input: 3
    output: 12
    96
    input: 4
    output: 16
    
    input: 3
    output: 12
    8
    input: 4
    output: 16
    
    input: 3
    output: 12
    98
    input: 4
    output: 16
    
    input: 3
    output: 12
    99

    input: 4
    output: 16
    
    input: 3
    output: 12
    7____140

     

    input: 4
    output: 16
    
    input: 3
    output: 12
    7____3933

    input: 4
    output: 16
    
    input: 3
    output: 12
    7______3935
    input: 4
    output: 16
    
    input: 3
    output: 12
    936
    input: 4
    output: 16
    
    input: 3
    output: 12
    937
    input: 4
    output: 16
    
    input: 3
    output: 12
    938

    input: 4
    output: 16
    
    input: 3
    output: 12
    7
    input: 4
    output: 16
    
    input: 3
    output: 12
    6

    input: 4
    output: 16
    
    input: 3
    output: 12
    96
    input: 4
    output: 16
    
    input: 3
    output: 12
    942______3943
    input: 4
    output: 16
    
    input: 3
    output: 12
    944

    input: 4
    output: 16
    
    input: 3
    output: 12
    96
    input: 4
    output: 16
    
    input: 3
    output: 12
    2
    input: 4
    output: 16
    
    input: 3
    output: 12
    947
    input: 4
    output: 16
    
    input: 3
    output: 12
    948
    input: 4
    output: 16
    
    input: 3
    output: 12
    949

    input: 4
    output: 16
    
    input: 3
    output: 12
    96
    input: 4
    output: 16
    
    input: 3
    output: 12
    951____3952
    input: 4
    output: 16
    
    input: 3
    output: 12
    953

    input: 4
    output: 16
    
    input: 3
    output: 12
    954
    input: 4
    output: 16
    
    input: 3
    output: 12
    955
    input: 4
    output: 16
    
    input: 3
    output: 12
    953

    input: 4
    output: 16
    
    input: 3
    output: 12
    957
    input: 4
    output: 16
    
    input: 3
    output: 12
    958

    input: 4
    output: 16
    
    input: 3
    output: 12
    7____140

    Enter the Lenth of rectangle:10
    Enter the Breadth of rectangle:12
    Enter the Redius of Circle:23
    Area of Rectangle = 120
    Perimeter of Rectangle = 44
    Area of Circle = 1661.06
    Circum of Circle = 144.44
    
    
    40

     

    input: 4
    output: 16
    
    input: 3
    output: 12
    40

    input: 4
    output: 16
    
    input: 3
    output: 12
    963

    Python3




    input: 4
    output: 16
    
    input: 3
    output: 12
    964

    input: 4
    output: 16
    
    input: 3
    output: 12
    965

     

    input: 4
    output: 16
    
    input: 3
    output: 12
    966
    input: 4
    output: 16
    
    input: 3
    output: 12
    967

    input: 4
    output: 16
    
    input: 3
    output: 12
    96
    input: 4
    output: 16
    
    input: 3
    output: 12
    8
    input: 4
    output: 16
    
    input: 3
    output: 12
    00______498
    input: 4
    output: 16
    
    input: 3
    output: 12
    02
    input: 4
    output: 16
    
    input: 3
    output: 12
    5

     

    input: 4
    output: 16
    
    input: 3
    output: 12
    04

    input: 4
    output: 16
    
    input: 3
    output: 12
    05
    input: 4
    output: 16
    
    input: 3
    output: 12
    06
    input: 4
    output: 16
    
    input: 3
    output: 12
    948

    ________ 308 ________ 306 ________ 310

    input: 4
    output: 16
    
    input: 3
    output: 12
    11
    input: 4
    output: 16
    
    input: 3
    output: 12
    00
    input: 4
    output: 16
    
    input: 3
    output: 12
    13
    input: 4
    output: 16
    
    input: 3
    output: 12
    953

    input: 4
    output: 16
    
    input: 3
    output: 12
    15
    input: 4
    output: 16
    
    input: 3
    output: 12
    16
    input: 4
    output: 16
    
    input: 3
    output: 12
    17
    input: 4
    output: 16
    
    input: 3
    output: 12
    18

    C#




    input: 4
    output: 16
    
    input: 3
    output: 12
    19

    input: 4
    output: 16
    
    input: 3
    output: 12
    20

    input: 4
    output: 16
    
    input: 3
    output: 12
    96
    input: 4
    output: 16
    
    input: 3
    output: 12
    22

     

    input: 4
    output: 16
    
    input: 3
    output: 12
    46
    input: 4
    output: 16
    
    input: 3
    output: 12
    47

    input: 4
    output: 16
    
    input: 3
    output: 12
    6

     

    input: 4
    output: 16
    
    input: 3
    output: 12
    7______3936
    input: 4
    output: 16
    
    input: 3
    output: 12
    2
    input: 4
    output: 16
    
    input: 3
    output: 12
    3
    input: 4
    output: 16
    
    input: 3
    output: 12
    2
    input: 4
    output: 16
    
    input: 3
    output: 12
    5

    input: 4
    output: 16
    
    input: 3
    output: 12
    7
    input: 4
    output: 16
    
    input: 3
    output: 12
    6

    input: 4
    output: 16
    
    input: 3
    output: 12
    96
    input: 4
    output: 16
    
    input: 3
    output: 12
    8
    input: 4
    output: 16
    
    input: 3
    output: 12
    9

    input: 4
    output: 16
    
    input: 3
    output: 12
    7____140

     

    input: 4
    output: 16
    
    input: 3
    output: 12
    7____141

    input: 4
    output: 16
    
    input: 3
    output: 12
    7______3935
    input: 4
    output: 16
    
    input: 3
    output: 12
    936
    input: 4
    output: 16
    
    input: 3
    output: 12
    937
    input: 4
    output: 16
    
    input: 3
    output: 12
    45

    input: 4
    output: 16
    
    input: 3
    output: 12
    7
    input: 4
    output: 16
    
    input: 3
    output: 12
    6

    input: 4
    output: 16
    
    input: 3
    output: 12
    96
    input: 4
    output: 16
    
    input: 3
    output: 12
    2
    Enter the Lenth of rectangle:10
    Enter the Breadth of rectangle:12
    Enter the Redius of Circle:23
    Area of Rectangle = 120
    Perimeter of Rectangle = 44
    Area of Circle = 1661.06
    Circum of Circle = 144.44
    
    
    47

     

    input: 4
    output: 16
    
    input: 3
    output: 12
    96
    input: 4
    output: 16
    
    input: 3
    output: 12
    52____353
    input: 4
    output: 16
    
    input: 3
    output: 12
    953

    input: 4
    output: 16
    
    input: 3
    output: 12
    55
    input: 4
    output: 16
    
    input: 3
    output: 12
    56
    input: 4
    output: 16
    
    input: 3
    output: 12
    953

    input: 4
    output: 16
    
    input: 3
    output: 12
    58
    input: 4
    output: 16
    
    input: 3
    output: 12
    59

    input: 4
    output: 16
    
    input: 3
    output: 12
    7____140

    Enter the Lenth of rectangle:10
    Enter the Breadth of rectangle:12
    Enter the Redius of Circle:23
    Area of Rectangle = 120
    Perimeter of Rectangle = 44
    Area of Circle = 1661.06
    Circum of Circle = 144.44
    
    
    40

     

    input: 4
    output: 16
    
    input: 3
    output: 12
    63

    PHP




    input: 4
    output: 16
    
    input: 3
    output: 12
    64

    input: 4
    output: 16
    
    input: 3
    output: 12
    65

    input: 4
    output: 16
    
    input: 3
    output: 12
    94

     

    input: 4
    output: 16
    
    input: 3
    output: 12
    67
    input: 4
    output: 16
    
    input: 3
    output: 12
    3____369
    input: 4
    output: 16
    
    input: 3
    output: 12
    70

    input: 4
    output: 16
    
    input: 3
    output: 12
    6

    input: 4
    output: 16
    
    input: 3
    output: 12
    7______38
    input: 4
    output: 16
    
    input: 3
    output: 12
    74____369
    input: 4
    output: 16
    
    input: 3
    output: 12
    949

    Enter the Lenth of rectangle:10
    Enter the Breadth of rectangle:12
    Enter the Redius of Circle:23
    Area of Rectangle = 120
    Perimeter of Rectangle = 44
    Area of Circle = 1661.06
    Circum of Circle = 144.44
    
    
    40

     

    Enter the Lenth of rectangle:10
    Enter the Breadth of rectangle:12
    Enter the Redius of Circle:23
    Area of Rectangle = 120
    Perimeter of Rectangle = 44
    Area of Circle = 1661.06
    Circum of Circle = 144.44
    
    
    41

    input: 4
    output: 16
    
    input: 3
    output: 12
    69
    input: 4
    output: 16
    
    input: 3
    output: 12
    80

    ________ 381 ________ 313 ________ 383

    ________ 384 ________ 385 ________ 386

    _______241____33____369

    input: 4
    output: 16
    
    input: 3
    output: 12
    90

     

    input: 4
    output: 16
    
    input: 3
    output: 12
    91

    input: 4
    output: 16
    
    input: 3
    output: 12
    92

    Javascript




    input: 4
    output: 16
    
    input: 3
    output: 12
    93

     

    input: 4
    output: 16
    
    input: 3
    output: 12
    94

    input: 4
    output: 16
    
    input: 3
    output: 12
    94

    input: 4
    output: 16
    
    input: 3
    output: 12
    67
    input: 4
    output: 16
    
    input: 3
    output: 12
    10

    input: 4
    output: 16
    
    input: 3
    output: 12
    6

    input: 4
    output: 16
    
    input: 3
    output: 12
    7
    input: 4
    output: 16
    
    input: 3
    output: 12
    8
    input: 4
    output: 16
    
    input: 3
    output: 12
    9

    Enter the Lenth of rectangle:10
    Enter the Breadth of rectangle:12
    Enter the Redius of Circle:23
    Area of Rectangle = 120
    Perimeter of Rectangle = 44
    Area of Circle = 1661.06
    Circum of Circle = 144.44
    
    
    40

     

    Enter the Lenth of rectangle:10
    Enter the Breadth of rectangle:12
    Enter the Redius of Circle:23
    Area of Rectangle = 120
    Perimeter of Rectangle = 44
    Area of Circle = 1661.06
    Circum of Circle = 144.44
    
    
    41

    input: 4
    output: 16
    
    input: 3
    output: 12
    7____1405

    input: 4
    output: 16
    
    input: 3
    output: 12
    7____1407
    C = 4 * a
    where a is the side length.
    40

    _______496____3953____243

    input: 4
    output: 16
    
    input: 3
    output: 12
    96
    Enter the Lenth of rectangle:10
    Enter the Breadth of rectangle:12
    Enter the Redius of Circle:23
    Area of Rectangle = 120
    Perimeter of Rectangle = 44
    Area of Circle = 1661.06
    Circum of Circle = 144.44
    
    
    413

     

    Enter the Lenth of rectangle:10
    Enter the Breadth of rectangle:12
    Enter the Redius of Circle:23
    Area of Rectangle = 120
    Perimeter of Rectangle = 44
    Area of Circle = 1661.06
    Circum of Circle = 144.44
    
    
    414

     

    Enter the Lenth of rectangle:10
    Enter the Breadth of rectangle:12
    Enter the Redius of Circle:23
    Area of Rectangle = 120
    Perimeter of Rectangle = 44
    Area of Circle = 1661.06
    Circum of Circle = 144.44
    
    
    415

    Đầu ra.
     

    Enter the Lenth of rectangle:10
    Enter the Breadth of rectangle:12
    Enter the Redius of Circle:23
    Area of Rectangle = 120
    Perimeter of Rectangle = 44
    Area of Circle = 1661.06
    Circum of Circle = 144.44
    
    
    4

    Độ phức tạp về thời gian. O(1) 
    Không gian phụ. Ô(1)

    Chu vi hình chữ nhật.
     

    Làm thế nào để bạn tìm thấy chu vi của một hình chữ nhật trong python?

    Chu vi hình chữ nhật được cho bởi công thức.
     

    C = 4 * a
    where a is the side length.
    4

    Ví dụ.
     

    input: 4
    output: 16
    
    input: 3
    output: 12
    4

     

    C++




    Enter the Lenth of rectangle:10
    Enter the Breadth of rectangle:12
    Enter the Redius of Circle:23
    Area of Rectangle = 120
    Perimeter of Rectangle = 44
    Area of Circle = 1661.06
    Circum of Circle = 144.44
    
    
    416

    Enter the Lenth of rectangle:10
    Enter the Breadth of rectangle:12
    Enter the Redius of Circle:23
    Area of Rectangle = 120
    Perimeter of Rectangle = 44
    Area of Circle = 1661.06
    Circum of Circle = 144.44
    
    
    417

    Enter the Lenth of rectangle:10
    Enter the Breadth of rectangle:12
    Enter the Redius of Circle:23
    Area of Rectangle = 120
    Perimeter of Rectangle = 44
    Area of Circle = 1661.06
    Circum of Circle = 144.44
    
    
    418

    input: 4
    output: 16
    
    input: 3
    output: 12
    96
    input: 4
    output: 16
    
    input: 3
    output: 12
    0
    input: 4
    output: 16
    
    input: 3
    output: 12
    1

     

    input: 4
    output: 16
    
    input: 3
    output: 12
    2
    input: 4
    output: 16
    
    input: 3
    output: 12
    3
    input: 4
    output: 16
    
    input: 3
    output: 12
    2
    Enter the Lenth of rectangle:10
    Enter the Breadth of rectangle:12
    Enter the Redius of Circle:23
    Area of Rectangle = 120
    Perimeter of Rectangle = 44
    Area of Circle = 1661.06
    Circum of Circle = 144.44
    
    
    425
    input: 4
    output: 16
    
    input: 3
    output: 12
    2
    Enter the Lenth of rectangle:10
    Enter the Breadth of rectangle:12
    Enter the Redius of Circle:23
    Area of Rectangle = 120
    Perimeter of Rectangle = 44
    Area of Circle = 1661.06
    Circum of Circle = 144.44
    
    
    427

    input: 4
    output: 16
    
    input: 3
    output: 12
    6

    input: 4
    output: 16
    
    input: 3
    output: 12
    7
    input: 4
    output: 16
    
    input: 3
    output: 12
    8
    Enter the Lenth of rectangle:10
    Enter the Breadth of rectangle:12
    Enter the Redius of Circle:23
    Area of Rectangle = 120
    Perimeter of Rectangle = 44
    Area of Circle = 1661.06
    Circum of Circle = 144.44
    
    
    431

    Enter the Lenth of rectangle:10
    Enter the Breadth of rectangle:12
    Enter the Redius of Circle:23
    Area of Rectangle = 120
    Perimeter of Rectangle = 44
    Area of Circle = 1661.06
    Circum of Circle = 144.44
    
    
    40

     

    input: 4
    output: 16
    
    input: 3
    output: 12
    933

    input: 4
    output: 16
    
    input: 3
    output: 12
    2
    Enter the Lenth of rectangle:10
    Enter the Breadth of rectangle:12
    Enter the Redius of Circle:23
    Area of Rectangle = 120
    Perimeter of Rectangle = 44
    Area of Circle = 1661.06
    Circum of Circle = 144.44
    
    
    43

    input: 4
    output: 16
    
    input: 3
    output: 12
    6

    input: 4
    output: 16
    
    input: 3
    output: 12
    7____32
    Enter the Lenth of rectangle:10
    Enter the Breadth of rectangle:12
    Enter the Redius of Circle:23
    Area of Rectangle = 120
    Perimeter of Rectangle = 44
    Area of Circle = 1661.06
    Circum of Circle = 144.44
    
    
    439

     

    input: 4
    output: 16
    
    input: 3
    output: 12
    7
    input: 4
    output: 16
    
    input: 3
    output: 12
    2
    Enter the Lenth of rectangle:10
    Enter the Breadth of rectangle:12
    Enter the Redius of Circle:23
    Area of Rectangle = 120
    Perimeter of Rectangle = 44
    Area of Circle = 1661.06
    Circum of Circle = 144.44
    
    
    442

     

    input: 4
    output: 16
    
    input: 3
    output: 12
    7____149
    Enter the Lenth of rectangle:10
    Enter the Breadth of rectangle:12
    Enter the Redius of Circle:23
    Area of Rectangle = 120
    Perimeter of Rectangle = 44
    Area of Circle = 1661.06
    Circum of Circle = 144.44
    
    
    445

    ________ 241 ________ 242 ________ 1448

    C = 4 * a
    where a is the side length.
    41
    Enter the Lenth of rectangle:10
    Enter the Breadth of rectangle:12
    Enter the Redius of Circle:23
    Area of Rectangle = 120
    Perimeter of Rectangle = 44
    Area of Circle = 1661.06
    Circum of Circle = 144.44
    
    
    450

     

    input: 4
    output: 16
    
    input: 3
    output: 12
    7
    input: 4
    output: 16
    
    input: 3
    output: 12
    8
    C = 4 * a
    where a is the side length.
    48

    Enter the Lenth of rectangle:10
    Enter the Breadth of rectangle:12
    Enter the Redius of Circle:23
    Area of Rectangle = 120
    Perimeter of Rectangle = 44
    Area of Circle = 1661.06
    Circum of Circle = 144.44
    
    
    40

     

    input: 4
    output: 16
    
    input: 3
    output: 12
    63

    Python3




    Enter the Lenth of rectangle:10
    Enter the Breadth of rectangle:12
    Enter the Redius of Circle:23
    Area of Rectangle = 120
    Perimeter of Rectangle = 44
    Area of Circle = 1661.06
    Circum of Circle = 144.44
    
    
    456

    Enter the Lenth of rectangle:10
    Enter the Breadth of rectangle:12
    Enter the Redius of Circle:23
    Area of Rectangle = 120
    Perimeter of Rectangle = 44
    Area of Circle = 1661.06
    Circum of Circle = 144.44
    
    
    457

     

    input: 4
    output: 16
    
    input: 3
    output: 12
    966
    Enter the Lenth of rectangle:10
    Enter the Breadth of rectangle:12
    Enter the Redius of Circle:23
    Area of Rectangle = 120
    Perimeter of Rectangle = 44
    Area of Circle = 1661.06
    Circum of Circle = 144.44
    
    
    459

    input: 4
    output: 16
    
    input: 3
    output: 12
    96
    input: 4
    output: 16
    
    input: 3
    output: 12
    8
    input: 4
    output: 16
    
    input: 3
    output: 12
    00
    Enter the Lenth of rectangle:10
    Enter the Breadth of rectangle:12
    Enter the Redius of Circle:23
    Area of Rectangle = 120
    Perimeter of Rectangle = 44
    Area of Circle = 1661.06
    Circum of Circle = 144.44
    
    
    463
    input: 4
    output: 16
    
    input: 3
    output: 12
    02
    Enter the Lenth of rectangle:10
    Enter the Breadth of rectangle:12
    Enter the Redius of Circle:23
    Area of Rectangle = 120
    Perimeter of Rectangle = 44
    Area of Circle = 1661.06
    Circum of Circle = 144.44
    
    
    465
    input: 4
    output: 16
    
    input: 3
    output: 12
    953
    Enter the Lenth of rectangle:10
    Enter the Breadth of rectangle:12
    Enter the Redius of Circle:23
    Area of Rectangle = 120
    Perimeter of Rectangle = 44
    Area of Circle = 1661.06
    Circum of Circle = 144.44
    
    
    467

     

    input: 4
    output: 16
    
    input: 3
    output: 12
    04

    Enter the Lenth of rectangle:10
    Enter the Breadth of rectangle:12
    Enter the Redius of Circle:23
    Area of Rectangle = 120
    Perimeter of Rectangle = 44
    Area of Circle = 1661.06
    Circum of Circle = 144.44
    
    
    469
    input: 4
    output: 16
    
    input: 3
    output: 12
    06
    Enter the Lenth of rectangle:10
    Enter the Breadth of rectangle:12
    Enter the Redius of Circle:23
    Area of Rectangle = 120
    Perimeter of Rectangle = 44
    Area of Circle = 1661.06
    Circum of Circle = 144.44
    
    
    471

    ________ 1472 ________ 306 ________ 498

    ________ 308 ________ 306 ________ 1477

    input: 4
    output: 16
    
    input: 3
    output: 12
    11
    input: 4
    output: 16
    
    input: 3
    output: 12
    00
    Enter the Lenth of rectangle:10
    Enter the Breadth of rectangle:12
    Enter the Redius of Circle:23
    Area of Rectangle = 120
    Perimeter of Rectangle = 44
    Area of Circle = 1661.06
    Circum of Circle = 144.44
    
    
    445
    input: 4
    output: 16
    
    input: 3
    output: 12
    953

    Enter the Lenth of rectangle:10
    Enter the Breadth of rectangle:12
    Enter the Redius of Circle:23
    Area of Rectangle = 120
    Perimeter of Rectangle = 44
    Area of Circle = 1661.06
    Circum of Circle = 144.44
    
    
    482
    Enter the Lenth of rectangle:10
    Enter the Breadth of rectangle:12
    Enter the Redius of Circle:23
    Area of Rectangle = 120
    Perimeter of Rectangle = 44
    Area of Circle = 1661.06
    Circum of Circle = 144.44
    
    
    483
    input: 4
    output: 16
    
    input: 3
    output: 12
    17
    input: 4
    output: 16
    
    input: 3
    output: 12
    18

    Java




    Enter the Lenth of rectangle:10
    Enter the Breadth of rectangle:12
    Enter the Redius of Circle:23
    Area of Rectangle = 120
    Perimeter of Rectangle = 44
    Area of Circle = 1661.06
    Circum of Circle = 144.44
    
    
    486

    Enter the Lenth of rectangle:10
    Enter the Breadth of rectangle:12
    Enter the Redius of Circle:23
    Area of Rectangle = 120
    Perimeter of Rectangle = 44
    Area of Circle = 1661.06
    Circum of Circle = 144.44
    
    
    417

    input: 4
    output: 16
    
    input: 3
    output: 12
    44
    input: 4
    output: 16
    
    input: 3
    output: 12
    45

     

    input: 4
    output: 16
    
    input: 3
    output: 12
    46
    input: 4
    output: 16
    
    input: 3
    output: 12
    47

    input: 4
    output: 16
    
    input: 3
    output: 12
    6

     

    input: 4
    output: 16
    
    input: 3
    output: 12
    7__
    input: 4
    output: 16
    
    input: 3
    output: 12
    936
    input: 4
    output: 16
    
    input: 3
    output: 12
    2
    input: 4
    output: 16
    
    input: 3
    output: 12
    3
    input: 4
    output: 16
    
    input: 3
    output: 12
    2
    Enter the Lenth of rectangle:10
    Enter the Breadth of rectangle:12
    Enter the Redius of Circle:23
    Area of Rectangle = 120
    Perimeter of Rectangle = 44
    Area of Circle = 1661.06
    Circum of Circle = 144.44
    
    
    425

    Enter the Lenth of rectangle:10
    Enter the Breadth of rectangle:12
    Enter the Redius of Circle:23
    Area of Rectangle = 120
    Perimeter of Rectangle = 44
    Area of Circle = 1661.06
    Circum of Circle = 144.44
    
    
    499
    input: 4
    output: 16
    
    input: 3
    output: 12
    2
    Enter the Lenth of rectangle:10
    Enter the Breadth of rectangle:12
    Enter the Redius of Circle:23
    Area of Rectangle = 120
    Perimeter of Rectangle = 44
    Area of Circle = 1661.06
    Circum of Circle = 144.44
    
    
    427

    input: 4
    output: 16
    
    input: 3
    output: 12
    7
    input: 4
    output: 16
    
    input: 3
    output: 12
    6

    input: 4
    output: 16
    
    input: 3
    output: 12
    96
    input: 4
    output: 16
    
    input: 3
    output: 12
    8
    input: 4
    output: 16
    
    input: 3
    output: 12
    00____1463
    C = 4 * a
    where a is the side length.
    408

    input: 4
    output: 16
    
    input: 3
    output: 12
    7____140

     

    input: 4
    output: 16
    
    input: 3
    output: 12
    7____3933

    input: 4
    output: 16
    
    input: 3
    output: 12
    7______3936
    input: 4
    output: 16
    
    input: 3
    output: 12
    935
    input: 4
    output: 16
    
    input: 3
    output: 12
    937
    C = 4 * a
    where a is the side length.
    417

    input: 4
    output: 16
    
    input: 3
    output: 12
    7
    input: 4
    output: 16
    
    input: 3
    output: 12
    6

    input: 4
    output: 16
    
    input: 3
    output: 12
    96
    input: 4
    output: 16
    
    input: 3
    output: 12
    2
    C = 4 * a
    where a is the side length.
    422
    Enter the Lenth of rectangle:10
    Enter the Breadth of rectangle:12
    Enter the Redius of Circle:23
    Area of Rectangle = 120
    Perimeter of Rectangle = 44
    Area of Circle = 1661.06
    Circum of Circle = 144.44
    
    
    471
    C = 4 * a
    where a is the side length.
    424
    input: 4
    output: 16
    
    input: 3
    output: 12
    98
    input: 4
    output: 16
    
    input: 3
    output: 12
    949

     

    input: 4
    output: 16
    
    input: 3
    output: 12
    96
    input: 4
    output: 16
    
    input: 3
    output: 12
    2
    Enter the Lenth of rectangle:10
    Enter the Breadth of rectangle:12
    Enter the Redius of Circle:23
    Area of Rectangle = 120
    Perimeter of Rectangle = 44
    Area of Circle = 1661.06
    Circum of Circle = 144.44
    
    
    442

     

    input: 4
    output: 16
    
    input: 3
    output: 12
    96
    input: 4
    output: 16
    
    input: 3
    output: 12
    951____3952
    input: 4
    output: 16
    
    input: 3
    output: 12
    953

    ________ 358 ________ 2435 ________ 2436

    input: 4
    output: 16
    
    input: 3
    output: 12
    7____140

    Enter the Lenth of rectangle:10
    Enter the Breadth of rectangle:12
    Enter the Redius of Circle:23
    Area of Rectangle = 120
    Perimeter of Rectangle = 44
    Area of Circle = 1661.06
    Circum of Circle = 144.44
    
    
    40

     

    input: 4
    output: 16
    
    input: 3
    output: 12
    63

    C#




    C = 4 * a
    where a is the side length.
    441

    C = 4 * a
    where a is the side length.
    442

    input: 4
    output: 16
    
    input: 3
    output: 12
    96
    input: 4
    output: 16
    
    input: 3
    output: 12
    22

     

    input: 4
    output: 16
    
    input: 3
    output: 12
    46
    input: 4
    output: 16
    
    input: 3
    output: 12
    47

    input: 4
    output: 16
    
    input: 3
    output: 12
    6

     

    input: 4
    output: 16
    
    input: 3
    output: 12
    7__
    input: 4
    output: 16
    
    input: 3
    output: 12
    936
    input: 4
    output: 16
    
    input: 3
    output: 12
    2
    input: 4
    output: 16
    
    input: 3
    output: 12
    3
    input: 4
    output: 16
    
    input: 3
    output: 12
    2
    Enter the Lenth of rectangle:10
    Enter the Breadth of rectangle:12
    Enter the Redius of Circle:23
    Area of Rectangle = 120
    Perimeter of Rectangle = 44
    Area of Circle = 1661.06
    Circum of Circle = 144.44
    
    
    425

    Enter the Lenth of rectangle:10
    Enter the Breadth of rectangle:12
    Enter the Redius of Circle:23
    Area of Rectangle = 120
    Perimeter of Rectangle = 44
    Area of Circle = 1661.06
    Circum of Circle = 144.44
    
    
    499
    input: 4
    output: 16
    
    input: 3
    output: 12
    2
    Enter the Lenth of rectangle:10
    Enter the Breadth of rectangle:12
    Enter the Redius of Circle:23
    Area of Rectangle = 120
    Perimeter of Rectangle = 44
    Area of Circle = 1661.06
    Circum of Circle = 144.44
    
    
    427

    input: 4
    output: 16
    
    input: 3
    output: 12
    7
    input: 4
    output: 16
    
    input: 3
    output: 12
    6

    input: 4
    output: 16
    
    input: 3
    output: 12
    96
    input: 4
    output: 16
    
    input: 3
    output: 12
    8
    Enter the Lenth of rectangle:10
    Enter the Breadth of rectangle:12
    Enter the Redius of Circle:23
    Area of Rectangle = 120
    Perimeter of Rectangle = 44
    Area of Circle = 1661.06
    Circum of Circle = 144.44
    
    
    431

    input: 4
    output: 16
    
    input: 3
    output: 12
    7____140

     

    input: 4
    output: 16
    
    input: 3
    output: 12
    7____3933

    input: 4
    output: 16
    
    input: 3
    output: 12
    7__
    input: 4
    output: 16
    
    input: 3
    output: 12
    936
    input: 4
    output: 16
    
    input: 3
    output: 12
    935
    input: 4
    output: 16
    
    input: 3
    output: 12
    937
    input: 4
    output: 16
    
    input: 3
    output: 12
    45

    input: 4
    output: 16
    
    input: 3
    output: 12
    7
    input: 4
    output: 16
    
    input: 3
    output: 12
    6

    input: 4
    output: 16
    
    input: 3
    output: 12
    96
    input: 4
    output: 16
    
    input: 3
    output: 12
    2
    Enter the Lenth of rectangle:10
    Enter the Breadth of rectangle:12
    Enter the Redius of Circle:23
    Area of Rectangle = 120
    Perimeter of Rectangle = 44
    Area of Circle = 1661.06
    Circum of Circle = 144.44
    
    
    439

     

    input: 4
    output: 16
    
    input: 3
    output: 12
    96
    input: 4
    output: 16
    
    input: 3
    output: 12
    2
    Enter the Lenth of rectangle:10
    Enter the Breadth of rectangle:12
    Enter the Redius of Circle:23
    Area of Rectangle = 120
    Perimeter of Rectangle = 44
    Area of Circle = 1661.06
    Circum of Circle = 144.44
    
    
    442

     

    input: 4
    output: 16
    
    input: 3
    output: 12
    96
    input: 4
    output: 16
    
    input: 3
    output: 12
    52____3952
    input: 4
    output: 16
    
    input: 3
    output: 12
    953

    ________ 2483 ________ 2435 ________ 2436

    input: 4
    output: 16
    
    input: 3
    output: 12
    7____140

    Enter the Lenth of rectangle:10
    Enter the Breadth of rectangle:12
    Enter the Redius of Circle:23
    Area of Rectangle = 120
    Perimeter of Rectangle = 44
    Area of Circle = 1661.06
    Circum of Circle = 144.44
    
    
    40

     

    input: 4
    output: 16
    
    input: 3
    output: 12
    63

    PHP




    input: 4
    output: 16
    
    input: 3
    output: 12
    64

    C = 4 * a
    where a is the side length.
    491

    Enter the Lenth of rectangle:10
    Enter the Breadth of rectangle:12
    Enter the Redius of Circle:23
    Area of Rectangle = 120
    Perimeter of Rectangle = 44
    Area of Circle = 1661.06
    Circum of Circle = 144.44
    
    
    417

     

    input: 4
    output: 16
    
    input: 3
    output: 12
    67
    input: 4
    output: 16
    
    input: 3
    output: 12
    3____2495______386
    C = 4 * a
    where a is the side length.
    497
    input: 4
    output: 16
    
    input: 3
    output: 12
    70

    input: 4
    output: 16
    
    input: 3
    output: 12
    6

    input: 4
    output: 16
    
    input: 3
    output: 12
    7______38
    input: 4
    output: 16
    
    input: 3
    output: 12
    402
    C = 4 * a
    where a is the side length.
    495
    input: 4
    output: 16
    
    input: 3
    output: 12
    953
    C = 4 * a
    where a is the side length.
    497______3406

    Enter the Lenth of rectangle:10
    Enter the Breadth of rectangle:12
    Enter the Redius of Circle:23
    Area of Rectangle = 120
    Perimeter of Rectangle = 44
    Area of Circle = 1661.06
    Circum of Circle = 144.44
    
    
    40

     

    input: 4
    output: 16
    
    input: 3
    output: 12
    933

    C = 4 * a
    where a is the side length.
    495
    input: 4
    output: 16
    
    input: 3
    output: 12
    410
    C = 4 * a
    where a is the side length.
    497
    input: 4
    output: 16
    
    input: 3
    output: 12
    412

     

    input: 4
    output: 16
    
    input: 3
    output: 12
    413
    input: 4
    output: 16
    
    input: 3
    output: 12
    414
    C = 4 * a
    where a is the side length.
    495
    input: 4
    output: 16
    
    input: 3
    output: 12
    86
    C = 4 * a
    where a is the side length.
    497
    input: 4
    output: 16
    
    input: 3
    output: 12
    90

     

    ________ 381 ________ 313 ________ 383

    input: 4
    output: 16
    
    input: 3
    output: 12
    422
    input: 4
    output: 16
    
    input: 3
    output: 12
    423
    input: 4
    output: 16
    
    input: 3
    output: 12
    86
    input: 4
    output: 16
    
    input: 3
    output: 12
    413
    input: 4
    output: 16
    
    input: 3
    output: 12
    86
    input: 4
    output: 16
    
    input: 3
    output: 12
    427
    input: 4
    output: 16
    
    input: 3
    output: 12
    949

     

    input: 4
    output: 16
    
    input: 3
    output: 12
    429

    input: 4
    output: 16
    
    input: 3
    output: 12
    92

    Javascript




    input: 4
    output: 16
    
    input: 3
    output: 12
    93

    input: 4
    output: 16
    
    input: 3
    output: 12
    432

    Enter the Lenth of rectangle:10
    Enter the Breadth of rectangle:12
    Enter the Redius of Circle:23
    Area of Rectangle = 120
    Perimeter of Rectangle = 44
    Area of Circle = 1661.06
    Circum of Circle = 144.44
    
    
    417

    input: 4
    output: 16
    
    input: 3
    output: 12
    7
    input: 4
    output: 16
    
    input: 3
    output: 12
    67
    input: 4
    output: 16
    
    input: 3
    output: 12
    436

    input: 4
    output: 16
    
    input: 3
    output: 12
    7
    input: 4
    output: 16
    
    input: 3
    output: 12
    6

    input: 4
    output: 16
    
    input: 3
    output: 12
    96
    input: 4
    output: 16
    
    input: 3
    output: 12
    8
    Enter the Lenth of rectangle:10
    Enter the Breadth of rectangle:12
    Enter the Redius of Circle:23
    Area of Rectangle = 120
    Perimeter of Rectangle = 44
    Area of Circle = 1661.06
    Circum of Circle = 144.44
    
    
    431

    input: 4
    output: 16
    
    input: 3
    output: 12
    7____140

     

    input: 4
    output: 16
    
    input: 3
    output: 12
    7____3933

    input: 4
    output: 16
    
    input: 3
    output: 12
    96
    input: 4
    output: 16
    
    input: 3
    output: 12
    447
    Enter the Lenth of rectangle:10
    Enter the Breadth of rectangle:12
    Enter the Redius of Circle:23
    Area of Rectangle = 120
    Perimeter of Rectangle = 44
    Area of Circle = 1661.06
    Circum of Circle = 144.44
    
    
    439

    input: 4
    output: 16
    
    input: 3
    output: 12
    96
    input: 4
    output: 16
    
    input: 3
    output: 12
    447
    Enter the Lenth of rectangle:10
    Enter the Breadth of rectangle:12
    Enter the Redius of Circle:23
    Area of Rectangle = 120
    Perimeter of Rectangle = 44
    Area of Circle = 1661.06
    Circum of Circle = 144.44
    
    
    442

    input: 4
    output: 16
    
    input: 3
    output: 12
    96
    Enter the Lenth of rectangle:10
    Enter the Breadth of rectangle:12
    Enter the Redius of Circle:23
    Area of Rectangle = 120
    Perimeter of Rectangle = 44
    Area of Circle = 1661.06
    Circum of Circle = 144.44
    
    
    407______3952
    input: 4
    output: 16
    
    input: 3
    output: 12
    953
    C = 4 * a
    where a is the side length.
    435
    C = 4 * a
    where a is the side length.
    436

    input: 4
    output: 16
    
    input: 3
    output: 12
    7

    input: 4
    output: 16
    
    input: 3
    output: 12
    459

    Enter the Lenth of rectangle:10
    Enter the Breadth of rectangle:12
    Enter the Redius of Circle:23
    Area of Rectangle = 120
    Perimeter of Rectangle = 44
    Area of Circle = 1661.06
    Circum of Circle = 144.44
    
    
    415

    Đầu ra.
     

    input: 4
    output: 16
    
    input: 3
    output: 12
    9

    Độ phức tạp về thời gian. O(1) 
    Không gian phụ. O(1) 

    Khuyến khích

    Giải các bài toán DSA trên GfG Practice

    Giải quyết vấn đề


    Ghi chú cá nhân của tôi arrow_drop_up

    Tiết kiệm

    Vui lòng Đăng nhập để nhận xét.

    Chu vi của một hàm trong Python là gì?

    Tham số là biến được liệt kê bên trong dấu ngoặc đơn trong định nghĩa hàm . Đối số là giá trị được gửi đến hàm khi nó được gọi.

    Làm thế nào để viết một chương trình Python để tính diện tích hình chữ nhật?

    Chương trình Python .
    chiều rộng=5
    chiều cao = 10
    diện tích = chiều rộng * chiều cao
    print("Diện tích hình chữ nhật="+str(diện tích))