In this tutorial you will learn about the C program to find Number is Divisible by 5 and 11 and its application with practical example.
C program to find Number is Divisible by 5 and 11
In this tutorial, we will learn to create a C program that will find Number is Divisible by 5 and 11 using C programming.
Prerequisites
Before starting with this tutorial we assume that you are best aware of the following C programming topics:
- Operators in C Programming.
- Basic Input and Output function in C Programming.
- Basic C programming.
- For loop in C programming.
- Conditional Statements in C programming.
- Arithmetic operations in C Programming.
Program to find Number is Divisible by 5 and 11 or not:-
The program will find whether a Number is Divisible by 5 and 11 or not. In c programming, it is possible to take numerical input from the user and check if that number is divisible by 5 and 11 or not with the help of a very small amount of code.
In this program, we will take a number in the input from the user to check if it’s prime or not.
With the help of this program, we can Check whether a Number is Divisible by 5 and 11 or not.
Algorithm:-
1 2 3 4 5 6 7 8 9 |
1. Declaring the variables for the program. 2. Taking the input number from the user. 3. Checking the number is divisible 5 and 11 or not. 4. Printing the result. 5. End the program. |
Program to find that the number is divisible by 5 and 11:-
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
/** * C program to check divisibility of any number */ #include <stdio.h> int main() { //declaring the variable for the program. int no; /* no = it will hold the integer value for the input number by the user.*/ /* Taking the Input number from user */ printf("Enter any number: "); //Scannig the input number from the user for calculations. scanf("%d", &no); /* * If num modulos division 5 is 0 * and num modulos division 11 is 0 then * the number is divisible by 5 and 11 both */ //Checking conditions if((no % 5 == 0) && (no % 11 == 0)) { //printing the output number is divisible by both printf("Number is divisible by 5 and 11"); } else { //printing the output number is not divisible by both printf("Number is not divisible by 5 and 11"); } return 0; } |
Output:-
In the above program, we have first initialized the required variable.
- no= it will hold the integer value of the input.
Input message for the user for the integer value.
Program Logic Code.
Printing output number is divisible or not.