Question: For a given number n, print numbers divisible by 3 up to that number(n included) Example: if n=15, print 3,6,9,12,15 Hint you can use modulus

For a given number n, print numbers divisible by 3 up to that number(n included) Example: if n=15, print 3,6,9,12,15 Hint you can use modulus statement (if (i%3==0)) n=15

Question 2:

Generate 10 numbers between 0 and 1 and add into list. Print first three elements of that list.

Question 3:

write a for loop or method to calculate summation of first n numbers i.e if n=3, it will print or return 6 (1+2+3)

Question 4:

Write a method to calculate age for a given date of birth year. Use this method in order to calculate age of person if date of birth is 1944 if age is the name of function, print(age(1944))

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!