Advertisement
Guest User

Untitled

a guest
Dec 22nd, 2019
437
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.44 KB | None | 0 0
  1. // 2019/12/22(日)
  2. // 3、7、21の倍数の表示
  3.  
  4. #include <stdio.h>
  5.  
  6. int main(void) {
  7. for (int i = 1; i <= 100; i++) {
  8. if ((i % 3 == 0) && (i % 7 == 0)) {
  9. printf("%dは21の倍数\n", i);
  10. } else if (i % 3 == 0) {
  11. printf("%dは3の倍数\n", i);
  12. } else if (i % 7 == 0) {
  13. printf("%dは7の倍数\n", i);
  14. } else {
  15. ;
  16. }
  17. }
  18. return 0;
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement