write a program to display the numbers in the following
format
4 4
3 3 3 3
2 2 2 2 2 2
1 1 1 1 1 1 1 1
0 0 0 0 0 0 0 0 0
1 1 1 1 1 1 1
2 2 2 2 2
3 3 3
4

Answer Posted / padmapriya

class Pattern{
public static void main(String[]args){
for(int i=4;i>0;i--){
for(int j=0;j<5-i;j++){
System.out.print(i);

}
for(int j=0;j<i;j++){
System.out.print(" ");
}
for(int j=0;j<i-1;j++){
System.out.print(" ");
}
for(int j=0;j<5-i;j++){
System.out.print(i);
}
System.out.println();
}

for(int i=0;i<5;i++){
for(int j=0;j<i;j++){
System.out.print(" ");
}
for(int j=0;j<9-2*i;j++){
System.out.print(i);
}
System.out.println();
}
}
}

Is This Answer Correct ?    1 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Write a program that takes a 5 digit number and calculates 2 power that number and prints it(should not use big integers and exponential functions)

6284


what is the diffrenet bettwen HTTP and internet protocol

1596


What is the difference between if else and switchstatement

1580


What does sizeof int return?

830


Function which gives a pointer to a binary trees const an integer value at each code, return function of all the nodes in binary tree.?

832


Explain what is the advantage of a random access file?

904


Draw a diagram showing how the operating system relates to users, application programs, and the computer hardware ?

2364


what are the facialities provided by you after the selection of the student.

1935


Can you apply link and association interchangeably?

896


In the DOS enveronment, normal RAM that resides beyond the 1mb mark. a) expanded memory b) swapped memory c) Extended memory d) none

981


What is a null pointer assignment error? What are bus errors, memory faults, and core dumps?

1178


What is the process to create increment and decrement stamen in c?

801


what are enumerations in C

932


How we can insert comments in a c program?

857


Is it possible to execute code even after the program exits the main() function?

1081