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
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)
what is the diffrenet bettwen HTTP and internet protocol
What is the difference between if else and switchstatement
What does sizeof int return?
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.?
Explain what is the advantage of a random access file?
Draw a diagram showing how the operating system relates to users, application programs, and the computer hardware ?
what are the facialities provided by you after the selection of the student.
Can you apply link and association interchangeably?
In the DOS enveronment, normal RAM that resides beyond the 1mb mark. a) expanded memory b) swapped memory c) Extended memory d) none
What is a null pointer assignment error? What are bus errors, memory faults, and core dumps?
What is the process to create increment and decrement stamen in c?
what are enumerations in C
How we can insert comments in a c program?
Is it possible to execute code even after the program exits the main() function?