Back To C++ Flow of Control Index
if remainder of a divided by b is equal to zero, a is divisible by b else a is not divisible by b
//program to input two numbers a and b and check whether a is divisible by b or not using if-else statement #include
#include
void main() { int a,b; clrscr(); cout<<"enter value for a"; cin>>a; cout<<"enter value for b"; cin>>b; if(a%b==0) { cout<<"a is divisible by b"; } else { cout<<"a is not divisible by b"; } getch(); }