1. 헿 가독성미안요


  2. import java.util.*;
  3. import java.lang.*;
  4. import java.io.*;
  5.  
  6. /* Name of the class has to be "Main" only if the class is public. */
  7. class Ideone
  8. {
  9. public static void main (String[] args) throws java.lang.Exception
  10. {
  11. int i,j;
  12. for(i=1;i<=10;i++)
  13. {
  14. System.out.println("3x"+i+"="+(3*i));
  15. }
  16.  
  17.  
  18.  
  19. for( i=10; i>0 ;i--){
  20. for( j=0;j<i;j++){
  21. System.out.print(" ");
  22. }
  23. if(i==10)
  24. System.out.print("*");
  25. for(j=i ;j<10 ;j++){
  26. System.out.print("*");
  27. }
  28. for(j=i ;j<10 ;j++){
  29. System.out.print("*");
  30. }
  31. System.out.print("\n");
  32.  
  33. }
  34. for( i=0; i<11 ;i++){
  35. for( j=0;j<i;j++){
  36. System.out.print(" ");
  37. }
  38. if(i==10){
  39. System.out.print("*");
  40. break;
  41. }
  42. for(j=i ;j<10 ;j++){
  43. System.out.print("*");
  44. }
  45. for(j=i ;j<10 ;j++){
  46. System.out.print("*");
  47. }
  48. System.out.print("\n");
  49.  
  50. }
  51.  
  52.  
  53.  
  54. }
  55. }


결과

3x1=3 3x2=6 3x3=9 3x4=12 3x5=15 3x6=18 3x7=21 3x8=24 3x9=27 3x10=30 * ** **** ****** ******** ********** ************ ************** **************** ****************** ******************** ****************** **************** ************** ************ ********** ******** ****** **** ** *