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
what will be the output for the following main() { printf("hi" "hello"); }
Write a program to show the change in position of a cursor using c
Place the #include statement must be written in the program?
Differentiate between a structure and a union.
What is c programing language?
what is the basis for selection of arrays or pointers as data structure in a program
how to write a c program to print list of fruits in alpabetical order?
Why do we need arrays in c?
What are the different types of C instructions?
An integer that indentifies the position of a data item in a sequence of data items a) value b) number c) index d) all of the above
What is line in c preprocessor?
How do you define structure?
List the difference between a "copy constructor" and a "assignment operator"?
what is the format specifier for printing a pointer value?
What is the difference between test design and test case design?