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
The performance of an operation in several steps with each step using the output of the preceding step a) recursion b) search c) call by value d) call by reference
Explain how do you determine the length of a string value that was stored in a variable?
What are high level languages like C and FORTRAN also known as?
Where register variables are stored in c?
What are pragmas and what are they good for?
How are portions of a program disabled in demo versions?
What is pass by value in c?
how to print the character with maximum occurence and print that number of occurence too in a string given ?
What is a stream?
Why is c called c?
What do you mean by dynamic memory allocation in c? What functions are used?
What is the code for 3 questions and answer check in VisualBasic.Net?
What is a file descriptor in c?
What are the advantages of using Unions?
Write a program to reverse a given number in c?