if one number is divisible by 5,then print "hello", if no. is divisible by 7, then print " word".if no. divisible 5&7 , then print " hello world".
Answers
Answered by
7
mbcdeetgdqdhbbsqsgheafvjussvv
Answered by
6
Program in C++
#include<iostream>
using namespace std;
int main()
{
int n;
cout<<"Enter a number : ";
cin>>n;
if(n % 5 == 0 && n % 7 == 0)
{
cout<<"hello world";
}
else if(n % 5 == 0)
{
cout<<"hello";
}
else if(n % 7 == 0)
{
cout<<"world";
}
else
{
cout<<"Number is neither divisible by 5 nor 7.";
}
return 0;
}
Similar questions