Coding Practice

Write a C program to check whether a number is divisible by 5 and 11 or not

Check a number is divisible by 5 and 11 or not
Sample Output
Enter a number: 33

This number is divisible by 11.

Process returned 0 (0x0)   execution time : 2.361 s
Press any key to continue.
Source Code
#include<stdio.h>

int main()
{
    int num;
    
    printf("Enter a number: ");
    scanf("%d", &num);

    if(num % 5 == 0)
    {
        printf("\nThis number is divisible by 5.\n");
    }
    else if(num % 11 == 0)
    {
        printf("\nThis number is divisible by 11.\n");
    }
    else
    {
        printf("\nThis number is not divisible by 5 or 11.\n");
    }
    return 0;
}
Sample Output
Enter a number: 45

This number is divisible by 5.

Process returned 0 (0x0)   execution time : 1.800 s
Press any key to continue.
Change Theme
X