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
Write a program to print ASCII code for a given digit.
What is the scope of static variable in c?
What is meant by inheritance?
What is include directive in c?
Explain what is meant by high-order and low-order bytes?
Explain union.
What is the value of a[3] if integer a[] = {5,4,3,2,1}?
What are pointers really good for, anyway?
Why is extern used in c?
What is the use of getchar() function?
What is the general form of function in c?
What is the basic structure of c?
State two uses of pointers in C?
What is the difference between int main and void main?
In C language, the variables NAME, name, and Name are all the same. TRUE or FALSE?