C Program to Check the Number is Divisible by 5 and 11

C program to check whether a number is divisible by 5 and 11; Through this tutorial, i am going to show you to check whether a number is divisible by 5 and 11 in c program using if-else statement and conditional operators.

Algorithm and Programs to Check the Number is Divisible by 5 and 11

  • Algorithm of to Check the Number is Divisible by 5 and 11
  • C Program to Check the Number is Divisible by 5 and 11 using If Else Statement
  • C Program to Check the Number is Divisible by 5 and 11 using Conditional Operator

Algorithm of Check the Number is Divisible by 5 and 11

Follow the below given algorithm to write a c program to check the number is divisible by 5 and 11; as follows:

  • Step 1: Start program.
  • Step 2: Read a number from the user.
  • Step 3: Check the a number is divisible by 5 and 11 using if else or conditional operators
  • Step 4: Print result.
  • Step 6:End program.

C Program to Check the Number is Divisible by 5 and 11 using If Else Statement

/* C Program to Check the Number is Divisible by 5 and 11 */
 
#include<stdio.h>
 
int main()
{
  	int number;
 
  	printf("\n Please Enter any Number to Check whether it is Divisible by 5 and 11 : ");
  	scanf("%d", &number);
  
  	if (( number % 5 == 0 ) && ( number % 11 == 0 ))
     	printf("\n Given number %d is Divisible by 5 and 11", number);
 
  	else
    	printf("\n Given number %d is Not Divisible by 5 and 11", number);
 
  return 0;
}

The result of the above c program; as follows:

Please Enter any Number to Check whether it is Divisible by 5 and 11 : 55
Given number 55 is Divisible by 5 and 11

C Program to Check the Number is Divisible by 5 and 11 using Conditional Operator

/* C Program to Check the Number is Divisible by 5 and 11 Using Conditional Operator */
#include<stdio.h>
 
int main()
{
	int number;
 
  	printf("\n Please Enter any Number to Check whether it is Divisible by 5 and 11 : ");
  	scanf("%d",&number);
 
  	((number % 5 == 0 ) && ( number % 11 == 0 )) ? 
  		printf("\n Given number %d is Divisible by 5 and 11", number) : 
			printf("\n Given number %d is Not Divisible by 5 and 11", number);
 
 	return 0;
 }

The result of the above c program; as follows:

Please Enter any Number to Check whether it is Divisible by 5 and 11 : 55
Given number 55 is Divisible by 5 and 11

More C Programming Tutorials

Be First to Comment

Leave a Reply

Your email address will not be published. Required fields are marked *