Dremendo Tag Line

Check multiple of 5 in C

if else - Question 5

In this question, we will see how to check if a number is a multiple of 5 or not in C programming using the if else statement. To know more about if else statement click on the if else statement lesson.

Q5) Write a program in C to input any number and check if it is multiple of 5 or not. A number is multiple of 5 if it is divisible by 5.

Program

#include <stdio.h>
#include <conio.h>

int main()
{
    int n;
    printf("Enter a number ");
    scanf("%d",&n);
    if(n%5==0)
    {
        printf("Multiple of 5");
    }
    else
    {
        printf("Not Multiple of 5");
    }
    return 0;
}

Output

Enter a number 10
Multiple of 5
video-poster