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 / vamsi talapatra

#include<iostream>
using namespace std;
int main(){
int n = 4;
int e = 2;
while(n>0){
for(int i = 0; i< e ; i++){
cout<<n<<" ";
}
cout<<endl;
e=e+2;
n--;
}

while(n<=4){
for(int i = 1; i< e ; i++){
cout<<n<<" ";
}
cout<<endl;
e=e-2;
n++;
}
return 0;
}

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

C program to find all possible outcomes of a dice?

1841


Is a house a shell structure?

688


what is a NULL Pointer? Whether it is same as an uninitialized pointer?

745


Explain Basic concepts of C language?

633


Create a registration form application by taking the details like username, address, phone number, email with password and confirm password (should be same as password).Ensure that the password is of 8 characters with only numbers and alphabets. Take such details for 3 users and display the details. While taking input password must appear as “****”.

2640






program for reversing a selected line word by word when multiple lines are given without using strrev

1934


find the value of y y = 1.5x+3 for x<=2 y = 2x+5 for x>2

1519


Calculate 1*2*3*____*n using recursive function??

1505


Discuss the function of conditional operator, size of operator and comma operator with examples.

666


What are examples of structures?

581


What is a scope resolution operator in c?

737


What is default value of global variable in c?

552


What does c mean before a date?

579


Why can’t we compare structures?

801


How can I make it pause before closing the program output window?

564