// 判断一个数n能否同时被3和5整除
#include <stdio.h>
int main()
{
int n;
printf("请输入一个整数:");
scanf("%d",&n);
if( n % 3 == 0 && n % 5 == 0 )
printf("这个数可以同时被3和5整除\n");
else
printf("这个数不可以同时被3和5整除\n");
return 0;
}
<img src="https://img-blog.csdn.net/20150423115036102?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvemhhb3lhcWlhbjU1Mg==/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/Center" alt="" />
<img src="https://img-blog.csdn.net/20150423115200474?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvemhhb3lhcWlhbjU1Mg==/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/Center" alt="" />
【c语言】判断一个数n能否同时被3和5整除
最新推荐文章于 2024-06-20 12:33:17 发布