12344321
123 321
12 21
1 1 how i print this program??

Answer Posted / guest

public class Numbers {
public static void main(String[] args){
int i,j,n=4;
for(i=0;i<=n;i++){
System.out.println();
for(j=1;j<=n-i;j++)
System.out.print(j);
for(j=0;j<2*i;j++)
System.out.print(" ");
for(j=n-i;j>=1;j--)
System.out.print(j);
}
}
}

Is This Answer Correct ?    16 Yes 3 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Create a registration form application by taking the details like username, address, phone number, email with password and confirm password (should be same as password).Ensure that the password is of 8 characters with only numbers and alphabets. Take such details for 3 users and display the details. While taking input password must appear as “****”.

2640


How are variables declared in c?

590


How do you view the path?

656


What is break statement?

623


How can I pad a string to a known length?

605






Why void main is used in c?

559


What the advantages of using Unions?

667


What is string length in c?

600


What are the 5 data types?

592


In c programming write a program that will print 10 multiples of 3 except 15,18,21 using looping

972


What is pointer & why it is used?

598


How to set file pointer to beginning c?

658


What does struct node * mean?

591


Is c compiled or interpreted?

657


Write program to remove duplicate in an array?

593