Tutorial Gateway

  • C
  • C#
  • Java
  • Python
  • SQL
  • MySQL
  • Js
  • BI Tools
    • Informatica
    • Talend
    • Tableau
    • Power BI
    • SSIS
    • SSRS
    • SSAS
    • MDX
    • R Tutorial
    • Alteryx
    • QlikView
  • More
    • C Programs
    • C++ Programs
    • Python Programs
    • Java Programs

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

by suresh

Write a C Program to Check the Number is Divisible by 5 and 11 with an example using If Else Statement, and the Conditional Operator.

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

This program helps the user to enter any number. Next, this program checks whether the number is divisible by both 5 and 11 using If Else.

/* 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;
}

OUTPUT

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

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

This program will use the Conditional Operator in C Programming to check whether it is divisible by both 5 and 11 in C.

/* 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;
 }

OUTPUT

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

Let me try another value

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

Placed Under: C Programs

  • C Tutorial
  • C# Tutorial
  • Java Tutorial
  • JavaScript Tutorial
  • Python Tutorial
  • MySQL Tutorial
  • SQL Server Tutorial
  • R Tutorial
  • Power BI Tutorial
  • Tableau Tutorial
  • SSIS Tutorial
  • SSRS Tutorial
  • Informatica Tutorial
  • Talend Tutorial
  • C Programs
  • C++ Programs
  • Java Programs
  • Python Programs
  • MDX Tutorial
  • SSAS Tutorial
  • QlikView Tutorial

Copyright © 2021 | Tutorial Gateway· All Rights Reserved by Suresh

Home | About Us | Contact Us | Privacy Policy