输入一个整数,判断它能否被3,5,7整除的程序代码
来源:学生作业帮助网 编辑:作业帮 时间:2024/11/16 16:58:59
#includeusingnamespacestd;classZ_chu{public:voidjudge(intn);};voidZ_chu::judge(intn){if(n%3==0&&n%5=
pravitesubcommand1_Click()dimn%n=inputbox("请输入一个整数","输入整数")ifnmod3=0andnmod7=0thenprint"A"elseprint"
#includevoidmain(){intN,status=0;printf("输入这个数:");scanf("%d",&N);if(N%3==0)status++;if(N%5==0)status
已修改好:#include"iostream.h"int main(){ int i; cin>>i; if(i%3=
我把SCANF里的中文去掉就正常了.
main(){intnum;printf("请输入一个整数:\n");scanf("%d",&num);if(num%2){printf("\n这是一个奇数\n");}else{printf("\n这
#include"stdio.h"main(){intx;printf("请输入一个数字:");scanf("%d",&x);if(x%3==0)printf("该数字能被3整除.");if(x%5=
a+b>cabs(a-b)再问:能编个完整的给我吗?谢谢。新手,看不懂啊……不胜感激再答:#includeinta,b,c;scanf("%d,%d,%d",&a,&b,&c);if(a>0&&b>0
#includeintmain(){intnum;inta;//百位intb;//十位intc;//个位scanf("%d",&num);a=num/100;//默认强制转为整型b=(int)(num
#includeintmain(){inta;intb=0,c=0,d=0;scanf("%d",&a);if(a%5==0)c=1;if(a%7==0)d=1;elseif(c==1&&d==1)p
PrivateSubCommand1_Click()Dima,b,cAsIntegerDimmaxRandomizea=Int(900*Rnd+100)b=Int(900*Rnd+100)c=Int(
Scannerin=newScanner(System.in);intnum=in.nextInt();if(num%3==0)System.out.println("这个数可以被3整除");else
#includevoidmain(){\x09longa;\x09printf("inputanumber:\n");\x09scanf("%d",&a);\x09if(a%3==0&&a%5==0&
#includevoidmain(){intnumber;intre[3];inti=0;scanf("%d",&number);if(number%3==0){re[i]=3;i++}if(numb
voidmain(){intn;printf("请输入一个整数:");scanf("%d",&n);if(n%3==0&&n%5==0&&n%7==0)printf("\n此数能被3,5,7整除\n"
各位数相加和能被3整除,那么这个数就能被3整除,如258各位数相加等于15,15能被3整除,那么258也能被3整除.能够被5整除的只要各位数是0或5就行啦.15和10都能被5整除.另外,0除以任何数都
inta,b;scanf("%d%d",&a,&b);while(a{intt=a;a=b;b=t;}if(a%b==0)printf("a能被b整除");elsepr
#includeintmain(){inta;intb=0,c=0,d=0;scanf("%d",&a);if(a%3==0)b=1;if(a%5==0)c=1;if(a%7==0)d=1;if(b*
'回答:用VB编写的代码如下:其中加了检测输入的值是否为整数Subzhengchu3and5()DimsuruAsStringsuru=InputBox("请输入一个整数")IfVal(suru)=F
intnumber;scanf("%d",&number);if(number%3==0&&number%5==0){printf("YES");}else{printf("NO");}