- Trending Categories
- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP

- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who

# C# program to print all the numbers divisible by 3 and 5 for a given number

To print the numbers divisible by 3 and 5, use the && operator and check two conditions −

f (num % 3 == 0 && num % 5 == 0) {}

If the above condition is true, that would mean the number is divisible by 3 as well as 5.

The following is the complete code −

## Example

using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace Demo { class MyApplication { static void Main(string[] args) { int num; num = 15; Console.WriteLine("Number: "+num); // checking if the number is divisible by 3 and 5 if (num % 3 == 0 && num % 5 == 0) { Console.WriteLine("Divisible by 3 and 5"); } else { Console.WriteLine("Not divisible by 3 and 5"); } Console.ReadLine(); } } }

## Output

Number: 15 Divisible by 3 and 5

- Related Questions & Answers
- Python program to print all the numbers divisible by 3 and 5 for a given number
- Program to print all the numbers divisible by 3 and 5 in C++
- Python Program to Print all Numbers in a Range Divisible by a Given Number
- Golang Program to Print all Numbers in a Range Divisible by a Given Number
- Golang Program to Find the Numbers which are Divisible by 7 and Multiple of 5 in a Given Range
- Largest number with the given set of N digits that is divisible by 2, 3 and 5 in C++
- Check if a large number is divisible by 2, 3 and 5 or not in C++
- Divide number into two parts divisible by given numbers in C++ Program
- Python Program for Efficient program to print all prime factors of a given number
- Count n digit numbers divisible by given number in C++
- Golang Program to print all integers between a range that aren't divisible by either 2 or 3
- Python Program to Print all Integers that are not Divisible by Either 2 or 3 and Lie between 1 and 50
- C Program for efficiently print all prime factors of a given number?
- Number of substrings divisible by 8 and not by 3 in C++
- Divisible by 37 for large numbers in C++ Program

Advertisements