Given the integer N, the task is to print all the numbers less than N, which are divisible by 3 and 5.
Input : 50 Output : 0 15 30 45 Input : 100 Output : 0 15 30 45 60 75 90
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 3 and 5. For this divide each number from 0 to N by both 3 and 5 and check their remainder. If remainder is 0 in both cases then simply print that number.
Below is the implementaion :
0 15 30 45 60 75 90
- Program to print all the numbers divisible by 5 or 7 for a given number
- Print k numbers where all pairs are divisible by m
- Print digit's position to be removed to make a number divisible by 6
- Smallest number divisible by first n numbers
- Sum of n digit numbers divisible by a given number
- Numbers that are not divisible by any number in the range [2, 10]
- Split a number as sum of K numbers which are not divisible by K
- Divide number into two parts divisible by given numbers
- Smallest n digit number divisible by given three numbers
- Count n digit numbers divisible by given number
- C++ program to print all Even and Odd numbers from 1 to N
- Find N numbers such that a number and its reverse are divisible by sum of its digits
- Program to print a pattern of numbers
- Program to print first n Fibonacci Numbers | Set 1
- Python Program for Efficient program to print all prime factors of a given number
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.