Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Gavnokod1
- {
- final static int N = 6;
- public static void main( String[] args ) {
- for( int row=1; row<=N; row++ ) {
- if( row%2 == 1 ) {
- for( int pos=1; pos<=row; pos++ ) {
- System.out.print(pos);
- if(pos!=row)System.out.print("-");
- }
- }
- else
- {
- for( int pos=row; pos>=1; pos-- ) {
- System.out.print(pos);
- if(pos!=1)System.out.print("-");
- }
- }
- System.out.println();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement