java - Why is this code block not running? -


i making diamond using ascii art. yes, know code beyond sloppy. anyways, last part not running inside of else block, leaving diamond not finished. full code: http://pastebin.com/14hnzade

current output:

http://pastebin.com/ytqkrrqe

the loop:

 for(int = 1; i<=size; i++) {      for(int j=1; j<=size; j++) {          if(j<i) {              system.out.print(" ");          }          else if(j==i || j>i) {              system.out.print("*");          } else {//this block not executing, , not know why.              for(int ki = 1; ki<=size; ki++) { // how fix it?                  for(int n = size; n>=1; n--) {                      if(j>=i) {                          system.out.print("*");                      } else {                          system.out.print(" ");                      }                  }              system.out.println();              }          }      }      system.out.println();  } 

one of conditions has met before gets else block:

if(j<i) {     system.out.print(" "); } else if(j==i || j>i) { 

j either less i or greater i or equal i. have specified possible conditions therefore else never execute...


Comments

Popular posts from this blog

php - How to add and update images or image url in Volusion using Volusion API -

javascript - jQuery UI Splitter/Resizable for unlimited amount of columns -

javascript - IE9 error '$'is not defined -