Page 28 - tp_Modula_v2.0
P. 28

On running the above program, you will get the following output:

                      Output
                   Enter the first number:10
                   Enter the second number:5
                   Difference of two numbers is 5





                  Program 6: To calculate the average marks of three subjects.
                      Program6.py
                   File  Edit  Format   Run   Options  Window    Help

                   sub1 = int(input('Enter the marks of first subject:'))
                   sub2 = int(input('Enter the marks of second subject:'))
                   sub3 = int(input('Enter the marks of third subject:'))


                   avg=(sub1+sub2+sub3)/3

                   print('Average marks is:', avg)




                  On running the above program, you will get the following output:
                      Output

                   Enter the marks of first subject:25
                   Enter the marks of second subject:25
                   Enter the marks of third subject:25
                   Average marks is: 25.0




                  Program 7: To calculate the volume and surface area of cylinder.

                      Program7.py
                   File  Edit  Format   Run   Options  Window    Help

                   pi = 22/7
                   height = float (input('Enter the height of cylinder:'))
                   radius = float (input('Enter the radius of cylinder:'))

                   volume = pi* radius * radius * height
                   surface_area = ((2*pi*radius*radius) + (2*pi*radius*height))


                   print('The volume of the cylinder is:', volume)
                   print('Surface area of the cylinder is:', surface_area)






                   26     Touchpad MODULAR (Version 2.0)
   23   24   25   26   27   28   29   30   31   32   33