![c program to check whether entered number is divisible by 10 c program to check whether entered number is divisible by 10](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg810Cct0LNhJhdrKeHZQJuo4S7KnxpdJuG1x0fYNKe4jzyvO2Dcp3BY-lqlo_Wm5nyzHJzPUlZMhzczZ4sbpOH_GGfQW0Oif6JSoJ3qaJKwrYE0T7WlbiiSAXDnH6tDHHrADKwXimRAkG-/s640/C+program+to+check+entered+number+is+divisible+by+10+or+not.jpg)
By using this program we can check whether the entered number is divisible by 10 or not, so first let us understand what is divisibility of a number by 10. It means that, when a number is divided by 10 we get 0 as reminder in first division, then that number is said to be divisible by 10. For example let us take 19, Here if we divide 19 by 10 we get 9 as reminder at first division therefore 19 is not divisible number by 10.
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjCkNDByb8W-CqhYb0N5PnlXu4jfP6SzLWPjHClk2kU82_LCfSpVjH2sRr4Ws0IHvPqfN_ypK4qt8XO_niCK5FQPO-KsTXyFSymj7xyn8a79-P1yQF5iN8dDxmMBdmsVP5T-Xlt6_2ojp5-/s200/Untitled-1.jpg)
Where as if we take some another number like 20, In this case if we divide 20 by 10 we get reminder as 0. so 20 is a divisible number by 10. This program work using this logic only.
Program:
#include <stdio.h>
#include <conio.h>
// Program to check entered number is divisible by 10. SlashMyCode.com
void main()
{
int a;
printf("Enter a Number \n");
scanf("%d",&a);
if (a%10==0)
{
printf("The number %d is divisible by 10",a);
}
else
{
printf("The number %d is NOT divisible by 10",a);
}
// Program to check entered number is divisible by 10. SlashMyCode.com
getch();
}
Output:
No comments:
Post a Comment
Feel free to ask us any question regarding this post