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
C program to find all possible outcomes of a dice?
Is a house a shell structure?
what is a NULL Pointer? Whether it is same as an uninitialized pointer?
Explain Basic concepts of C language?
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 “****”.
program for reversing a selected line word by word when multiple lines are given without using strrev
find the value of y y = 1.5x+3 for x<=2 y = 2x+5 for x>2
Calculate 1*2*3*____*n using recursive function??
Discuss the function of conditional operator, size of operator and comma operator with examples.
What are examples of structures?
What is a scope resolution operator in c?
What is default value of global variable in c?
What does c mean before a date?
Why can’t we compare structures?
How can I make it pause before closing the program output window?