Page 39 - ipp11
P. 39

(d)
                              Name             Salary
                         Priyanka Sharma 78000
                         Amrita Verma     65000
                         Nehal Khanna     89000
                      (e)
                           ProjectName        StartDate
                         AI Development   2025-02-15
                         Web Design       2025-03-10
                         Digital Marketing 2025-02-28


                                                   SECTION E (2 × 5 = 10 Marks)
                 36.  Answer the following questions:                                                 (1+2+2 = 5)
                      (a)  Draw a flowchart to check whether a given number is even or odd.
                      (b)  Write a Python program to check whether a given number is divisible by 5 and 7.
                      (c)  Write a Python program to find the sum of all the digits of a given number.
                Ans.  (a)
                                                           Start



                                                        Input Number






                                          Yes                If             No
                                                       Number%2==0


                              Display “Even Number”                        Display “Odd Number”





                                                            END



                      (b)  num = int(input("Enter a number: "))
                        if num % 5 == 0 and num % 7 == 0:
                            print("number", num, "is divisible by both 5 and 7")
                        else:
                            print("number", num, "is not divisible by both 5 and 7")
                      (c)  num = int(input("Enter a number: "))
                        n=num
                        sum = 0
                        while num > 0:
                            digit = num % 10
                            sum += digit
                            num //= 10
                        print("Sum of all digits of a number", n, "is", sum)





                                                              M.9
   34   35   36   37   38   39   40   41   42   43   44