Page 102 - 2611_SmartGPT Pro V(5.0) C-8
P. 102

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

                      Output

                   Input the sides of the triangle:
                   A: 2.3
                   B: 5.3
                   C: 9.5
                   Scalene triangle



                  Program 13: To add two numbers using function.

                      Program13.py

                   File  Edit  Format   Run   Options  Window    Help

                   def add(a, b):
                       sum = a * b
                       return sum
                   numl = int(input("Enter first number: "))
                   num2 = int(input("Enter second number: "))
                   print("The sum is",add(numl,num2))





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

                      Output

                   Enter first number: 5
                   Enter second number: 6
                   The sum is 11




                  Program 14: To find the product of two numbers using function.


                      Program14.py
                   File  Edit  Format   Run   Options  Window    Help

                   def prod(a, b):
                       multi = a * b
                       return multi
                   numl = int(input("Enter first number: "))
                   num2 = int(input("Enter second number: "))
                   print("The product is",prod(numl,num2))











                  100   Computer Science (V5.0)-VIII
   97   98   99   100   101   102   103   104   105   106   107