# C program to check if a number is divisible by 3

### C program to check if a number is divisible by 3

#### Problem Description

This C programming example is to check whether a given number is divisible by 3 or not. You can achieve this by applying multiple programming logic. Here, modulus operator (%) is used to find out if entered number is divisible by 3.

##### C program to check if a number is divisible by 3 - Source code

#include <stdio.h> int main() { int number; printf("Enter number:\n"); scanf("%d",&number); if ((number % 3) == 0) printf("%d is a multiple of 3",number); else printf("%d is not a multiple of 3",number); return 0; }

#### Program Output

Case 1: Enter number: 493648 493648 is not a multiple of 3 Case 2: Enter number: 98274651 98274651 is a multiple of 3

#### Program Explanation

1. This program simply asks user to input an integer number. 2. In order to check for its divisibility by 3, modulus operator (%) is used. This operator return the remainder after dividing the given number by another number. 3. If the modulus operator return 0 as remainder, the number is multiple of 3. Otherwise, it is not a multiple of 3.