• Python Program To Add Two Numbers

    In this program we will add 2 static numbers in python. For this u should have basic knowledge of python of data types & print. But python is so easy. you can do programming easily. Follow the below simple steps.
    Step 1: Open terminal & write the following code
              a=5
              b=10
              sum=a+b
              print('sum of a & b is',sum)
    Step 2: Press enter & see the output
    Step 3:The output will be
              sum of a & b is 15
    Notes : Line 1: a=5
                             Here a is a variable & 5 is stored in variable a
                 Line 2: b=10
                             Here b is a variable & 10 is stored in variable b
                 Line 3: sum=a+b
                             sum is a variable & the value of variable a & b is added & stored in sum variable.
                 Line 4: print('sum of a & b is',sum)
                             The print() prints the output to screen .Here it prints sum of a & b is 15.

           
  • You might also like

    No comments:

    Post a Comment