Learn about C Program to Check Number is Multiple of 7 or not in the below code example. Also refer the comments in the code snippet to get a detailed view about what’s actually happening.
Contents
C Program to Check Number is Multiple of 7 or not
14, 21, 28, 35, 42, 49, 56, 63, 70,… and so on are the multiples of 7. If a number is a multiple of another number, it is divisible by the original number evenly. For example, 14 divided by 7 equals 2, indicating that it is a multiple of 7.
A multiple of 7 is any number that can be expressed in the form 7n, where n is a natural number. So, if there are two values p and q, we can say that q is a multiple of p if q = np for some natural integer n.
Program:
#include<stdio.h>
int main()
{
int number;
printf("Enter a number: ");
scanf("%d",&number);
if(number%7==0)
{
printf("%d is multiple of 7.",number);
}
else
{
printf("%d is not multiple of 7.",number);
}
return 0;
}
Output:
Enter a number: 21
21 is multiple of 7.
Hope above code works for you and Refer the below Related Codes to gain more insights. Happy coding and come back again.
Similar Codes :
Swap Two Number using a macro in C
Swapping program in C without using any temporary variable