vProgram
/*WAP divisible by 3 and 5 or both */
#include<iostream.h>
#include<conio.h>
void main()
{
int no;
clrscr();
cout<<"\n\t\t Enter Number
:";
cin>>no;
if(no%3==0)
{
if(no%5==0)
{
cout<<"divisible by 3 & 5";
}
else
{
cout<<"divisible by 3 Only";
}
}
else
{
if(no%5==0)
{
cout<<"\n\t\t Divisible By 5 Only";
}
else
{
cout<<"\n \t\tnot Divisible 5 & 3";
}
}
getch();
}
|
vOutput
Enter number:30
Divisible by 3 & 5
|
No comments:
Post a Comment