Programming

C – Check Entered Number is Exactly Divisible by 5 but not 11

Write a program that checks whether the number entered by the user is exactly divisible by 5 but not by 11. 

C Code

#include <stdio.h>
#include <conio.h>
#include <math.h>
void main()
{

int number;

printf("enter number:");
scanf("%d", &number);

if(number%5==0 && number%11!=0)
printf("%d is divisible by 5 but not by 11", number);
else
printf("condition is not satisfied");

getch();
}

Output

divisible by 5 but not 11
divisible by 5 but not 11

Tuts

About Author

Tutsmaster.org provides tutorials related to tech and programmings. We are also setting up a community for the users and students.