Jump to content

Need help in NestedLoope ...

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
1 reply to this topic

#1
BenzR

BenzR

    Newbie

  • Members
  • Pip
  • 3 posts
i am a beginner of java...i find it is quite hard for me:crying:
i wanna know how to print out like this?

88888881
88888812
88888123
88881234
88812345
88123456
81234567
12345678

could someone give me the solution? thank you so much:crying:

#2
wim DC

wim DC

    Writes binary right handed and hex left handed

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 2,084 posts
for(int i=0 ; i<8 ; i++){
  for(int j=0 ; j<(7-i) ; j++){
    System.out.print("8");
  }
  for(int k=0 ; k<=i ; k++){
    System.out.print(k+1);
  }
  System.out.println();
}