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

Answer Posted / harika

package basic_java_examples;

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 ?    4 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Can a variable be both const and volatile?

669


What does struct node * mean?

595


Explain what is the difference between #include and #include 'file' ?

579


Are pointers integers in c?

607


Not all reserved words are written in lowercase. TRUE or FALSE?

719






Can a void pointer point to a function?

565


Find duplicates in a file containing 6 digit number (like uid) in O (n) time.

2602


How can you convert integers to binary or hexadecimal?

612


Write a program to check whether a number is prime or not using c?

571


Describe the modifier in c?

597


What is function prototype?

607


what does static variable mean?

649


What is the difference between text and binary i/o?

586


Explain the difference between getch() and getche() in c?

563


Write a program to reverse a string.

631