アットウィキロゴ

KS > practice > Study04-01

  1. /** 九九の表を作成する st. 0を含むものは▲, 4を含むものは■, 0と4を両方含むものは◎ */
  2. package Practice04;
  3.  
  4. public class Study01 {
  5.  
  6. public static void main(String[] args) {
  7.  
  8. for (int i = 1; i <= 9; i++) {
  9.  
  10. for (int j = 1; j <= 9; j ++) {
  11. if (i * j % 10 == 0 && (i * j % 10 == 4 || (i * j / 10) % 10 == 4)) {
  12. System.out.print("◎" + " ");
  13. } else if (i * j % 10 == 0) {
  14. System.out.print("▲" + " ");
  15. } else if (i * j % 10 == 4 || (i * j / 10) % 10 == 4) {
  16. System.out.print("■" + " ");
  17. } else {
  18. System.out.print(i * j + " ");
  19. }
  20.  
  21. }
  22. System.out.println();
  23. }
  24. }
  25. }
  26.  
最終更新:2013年05月19日 00:06