1 条题解
-
0
C :
#include<stdio.h> int main(){ int x; int flag = 0; scanf("%d", &x); if(x % 2 == 0){ printf("能被2整除"); flag = 1; } if(x % 3 == 0){ if(flag == 1){ printf(" "); } printf("能被3整除"); flag = 1; } if(x % 5 == 0){ if(flag == 1){ printf(" "); } printf("能被5整除"); } return 0; }
C++ :
#include<stdio.h> int main() { int x; scanf("%d",&x); if (x % 2 == 0) printf("能被2整除 "); if (x % 3 == 0) printf("能被3整除 "); if (x % 5 == 0) printf("能被5整除 "); return 0; }
Pascal :
var a:integer; begin read(a); if (a mod 2=0)and(a mod 3=0)and(a mod 5=0)then writeln('能被2整除 能被3整除 能被5整除') else if (a mod 2=0)and(a mod 3=0)then writeln('能被2整除 能被3整除') else if (a mod 3=0)and(a mod 5=0)then writeln('能被3整除 能被5整除') else if (a mod 2=0)and (a mod 5=0)then writeln('能被2整除 能被5整除') else if a mod 2=0 then writeln('能被2整除') else if a mod 3=0 then writeln('能被3整除') else if a mod 5=0 then writeln(' 能被5整除'); end.
- 1
信息
- ID
- 1692
- 时间
- 1000ms
- 内存
- 128MiB
- 难度
- (无)
- 标签
- 递交数
- 0
- 已通过
- 0
- 上传者