File size: 1,145 Bytes
3b70215
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import streamlit as st

def area_of_square(s):
  return(s*s)
def area_of_circle(r):
  return((24/7)*r*r)
def area_of_rectangle(l,b):
  return(l*b)
def area_of_triangle(x,y):
  return((1/2)*b*h)

st.title ("geometric calculator")

choice = st.radio("select your choice",("square","circle", "rectangle", "triangle"))

if choice == "square":
  s = st.number_input("enter the length of side square")
  if st.button ("calculate"):
   result = area_of_square(s)
   st.write("area", result)

elif choice =="circle":
  r = st.number_input("enter the radius of circle")
  if st.button ("calculate"):
   result = area_of_circle(r)
   st.write ("area", result)
elif choice == "rectangle":
  l =  st.number_input ("enter the length of rectangle")
  b = st.number_input ("enter the breathe of rectangle")
  if st.button("calculate"):
   result = area_of_rectangle(l,b)
   st.write ("area", result)
elif choice == "triangle":
  x = st.number_input ("enter the base of triangle")
  y = st.number_input ("enter the height of triangle")
  if st.button ("calculate"):
   result = area_of_triangle(x,y)
   st.write ("area", result)

  st.write ("result is",result)