Page 22 - PlusGPT_V2.1_C8_Flipbook
P. 22

Program 6: To find the last digit of a number.


















                   Program 7: To find the sum of the first N natural numbers.




















                             Let’s BaCk-uP


                         The input() function takes the user’s input while a program executes.
                         The print() function prints or sends the output to the standard output device, which is usually
                       a monitor.

                         Variables are memory reference points where we store values which can be accessed or
                       changed later.

                         A data type specifies the type of value a variable can contains.
                         Comments enable us to understand the way a program works.
                         Operators  can  be  defined  as  special  symbols  which perform  arithmetic  and  logical
                       computation.
                         Arithmetic operators perform arithmetic operations between two operands.




















                  20    Premium Edition-VIII
   17   18   19   20   21   22   23   24   25   26   27