wap to input nos and display all nos which is divisble by 5 qnd 6
Answers
Answered by
0
Answer:
Input : 20
Output : 5 7 10 14 15 20
Input: 50
Output: 5 7 10 14 15 20 21 25 28 30 35 40
Approach: For example, let’s take N = 20 as a limit, then the program should print all numbers less than 20 which are divisible by both 5 or 7. For this divide each number from 0 to N by both 5 and 7 and check their remainder. If the remainder is 0 in both cases then simply print that number.
Similar questions