#include
void main()
{
int n;
printf("please input the data:\n");
scanf("%d",&n);
if(n%3==0&&n%5==0)
printf("the %d can be divided by 3 and 5",n);
else
printf("the %d cannot be divided by 3 and 5",n);
return 0;
}
if(n%3==0 && n%5==0)
这条语句就够了。
---------------------------------
比如说:
int n = 15;
if(n%3==0 && n%5==0)
printf("%d能同时被3和5整除\n",n);
else
printf("%d不能同时被3和5整除\n",n);
#include
main()
{
int a;
printf("请输入待判断整数:\n");
scanf("%d",&a);
if(a%3==0&&a%5==0)
printf("%d能被3和5整除",a);
else
printf("%d不能被3和5整除",a);
}