how can i get output the following...
5 4 3 2 1
4 3 2 1
3 2 1
2 1
1
and
1
2 3
4 5 6
7 8 9 10
11 12 13 14 15
plz plz...
Answer Posted / anas
for(i=n;i>=1;i--)
{
for(c=1;c<=n-i;c++)
{
cout<<" ";
}
for(k=i;k>=1;k--)
{
cout<<k;
}
cout<<"\n";
}
----------------------------------------------
#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
//for second.
int n=1;
for(int i=1;i<=5;i++)
{
for(int j=1;j<=i;j++)
{
cout<<n<<" ";
n++;
}
cout<<"\n";
}
getch();
}
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
What is difference between structure and union in c?
What is dynamic variable in c?
What is the purpose of ftell?
how to make a scientific calculater ?
5 Write an Algorithm to find the maximum and minimum items in a set of ‘n’ element.
What does volatile do?
Function calling procedures? and their differences? Why should one go for Call by Reference?
What are c preprocessors?
What is the use of getch ()?
write a program to rearrange the array such way that all even elements should come first and next come odd
Hai what is the different types of versions and their differences
What is file in c preprocessor?
What is a const pointer?
How to check whether string is a palindrome, WITHOUT USING STRING FUNCTIONS?
What is the difference between ‘g’ and “g” in C?