Answer to Question #263112 in Python for python

Question #263112

Find the sum of the first 10 numbers that are divisible by 3 and 9.

Sample Output

495


1
Expert's answer
2021-11-09T00:24:44-0500
def result(N):

   

  #iterating vode starting from 0 to num

  for num in range(N):

     

      # creating if condition for assigning numbers diviseble by 3 and 9

      if num % 3 == 0 and num % 9 == 0:

        print(str(num) + " ", end = "")

         

      else:

        pass

 

# Driver code

if __name__ == "__main__":

   

  # number we want added here

  N = int(input())

   

  # Calling function

  result(N)

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS