アットウィキロゴ

ouchi > Practice > Study04-01

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