Advertisement
Guest User

Untitled

a guest
Nov 8th, 2016
195
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.88 KB | None | 0 0
  1. import java.util.Scanner;
  2. public class JavaApplication15 {
  3. //organization sucks, I know
  4. public static void main(String[] args) {
  5. Scanner stdin = new Scanner(System.in);
  6. int size;
  7.  
  8. size = stdin.nextInt();
  9. for(int i = 1; i <= size; i++){
  10. for(int j = size; j>= 1; j--){
  11. if(j>=i){
  12. System.out.print(" ");
  13. }else{
  14. System.out.print("*");
  15. for(int ki = j; ki<= j; ki++){
  16. if(ki<=j)
  17. System.out.print("*");
  18. }
  19.  
  20.  
  21. }
  22.  
  23. }
  24. System.out.println();
  25. }
  26.  
  27. for(int i = 1; i<=size; i++){
  28. for(int j=1; j<=size; j++){
  29. if(j<i){
  30. System.out.print(" ");
  31. }
  32. else if(j==i || j>i){
  33.  
  34. System.out.print("*");
  35.  
  36.  
  37. }else { //this block is not executing, and I do not know why.
  38. for(int ki = 1; ki<=size; ki++){ // how do I fix it?
  39. for(int n = size; n>=1; n--){
  40. if(j>=i)
  41. System.out.print("*");
  42. else
  43. System.out.print(" ");
  44. }
  45. System.out.println();
  46. }
  47. }
  48. }
  49. System.out.println();
  50. }
  51.  
  52. for(int i = 1; i<=size; i++){ // copy of block not executing
  53. for(int j = size; j>=1; j--){
  54. if(j>=i)
  55. System.out.print("*");
  56. else
  57. System.out.print(" ");
  58. }
  59. System.out.println();
  60. }
  61.  
  62.  
  63. }
  64.  
  65. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement