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

State two uses of pointers in C?

859


Explain how do you convert strings to numbers in c?

859


Explain what are global variables and explain how do you declare them?

864


Is c++ based on c?

866


I completed my B.tech (IT). Actually I want to develop virtual object that which will change software technology in the future. To develop virtual object what course I have to take. can I any professor to help me.

1975


Do you know what are the properties of union in c?

822


Simplify the program segment if X = B then C ← true else C ← false

2821


printf(), scanf() these are a) library functions b) userdefined functions c) system functions d) they are not functions

892


What are the 4 types of unions?

828


write a program to convert a expression in polish notation(postfix) to inline(normal) something like make 723+* (2+3) x 7 (not sure) just check out its mainly printing expression in postfix form to infix.

3764


How can I open files mentioned on the command line, and parse option flags?

844


Why & is used in c?

952


Tell me about low level programming languages.

903


What is the difference between #include and #include 'file' ?

838


why wipro wase

2068