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 void main ()?
How do I read the arrow keys? What about function keys?
What is the explanation for modular programming?
What is a spanning Tree?
How can I implement sets or arrays of bits?
I have a varargs function which accepts a float parameter?
write a program to rearrange the array such way that all even elements should come first and next come odd
What is difference between class and structure?
What is the correct code to have following output in c using nested for loop?
Are comments included during the compilation stage and placed in the EXE file as well?
Write a program to print fibonacci series using recursion?
What are keywords c?
PLS U SENS ME INTERVIEW O. MY EMAIL ADD, SOFIYA.SINGH@GMAIL.COM
How do c compilers work?
Why is c faster?