解题思路:
不用循环,只用条件判断语句
注意事项:
参考代码:
a = int(input())
if a % 3 == 0 and a % 5 == 0 and a % 7 == 0:
print('3 5 7')
elif a % 3 == 0 and a % 5 == 0 and a % 7 != 0:
print('3 5')
elif a % 3 == 0 and a % 5 != 0 and a % 7 == 0:
print('3 7')
elif a % 3 != 0 and a % 5 == 0 and a % 7 == 0:
print('5 7')
elif a % 3 == 0 and a % 5 != 0 and a % 7 != 0:
print('3')
elif a % 3 != 0 and a % 5 == 0 and a % 7 != 0:
print('5')
elif a % 3 != 0 and a % 5 != 0 and a % 7 == 0:
print('7')
else:
print('n')
0.0分
1 人评分
C语言程序设计教程(第三版)课后习题9.8 (C语言代码)浏览:1238 |
A+B for Input-Output Practice (IV) (C语言代码)浏览:551 |
C语言程序设计教程(第三版)课后习题6.3 (C语言代码)浏览:511 |
小明A+B (C语言代码)浏览:1317 |
C语言程序设计教程(第三版)课后习题7.1 (C语言代码)浏览:539 |
C语言程序设计教程(第三版)课后习题5.7 (C语言代码)浏览:606 |
简单的a+b (C语言代码)浏览:560 |
2006年春浙江省计算机等级考试二级C 编程题(2) (C语言代码)浏览:503 |
水仙花 (C语言代码)浏览:1163 |
淘淘的名单 (C语言代码)浏览:1309 |