void main()
{
int n;
printf("请输入一个整数:");
scanf("%d",&n);
if(n%3==0&&n%5==0&&n%7==0)
printf("\n此数能被3,5,7整除\n");
else
printf("\n此数不能被3,5,7整除\n");
}
你的问题是输入一个整数能同时被3,5,7整除,还是有一个能整除就行
完整的C++程序:
//能同时被3,5,7,整除
#include
using namespace std;
int main()
{
int n;
cout<<"please input a number"<
if(n%(3*5*7)==0)
cout<<"the number could div 3,5,7"<
cout<<" the number can't"<
}
//有一个能整除就算
# include
using namespacae std;
int main()
{
int n;
cout<<"Please input a number:"<
if(n%3==0)
cout<<"the number can achieve it"<
cout<<"the number can achieve it"<
cout<<"the number can achieve it"<
}
function test(ii){
if ii%3<>0 then return false;
if ii%7<>0 then return false;
if ii%5<>0 then return false;
return true;
}
#include
void main()
{
int a;
printf("请输入一个整数: \n");
scanf("%d",&a);
if(a%3==0)
printf("能被3整除!\n");
if(a%5==0)
printf("能被5整除!\n");
if(a%7==0)
printf("能被7整除!\n");
}