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


Please Help Members By Posting Answers For Below Questions

How does pointer work in c?

723


How can I find out if there are characters available for reading?

732


What is meant by preprocessor in c?

633


Why is c fast?

705


If jack lies on Mon, Tue Wed and jill lies on Thursday, Friday and Saturday. If both together tell they lied yesterday. So c the given options and then c cos in the given dates one will be saying the truth and one will be lying. I got Thursday as option because jack is saying the truth he lied yest but jill is lying again as he lies on that day.

1873






What is the maximum no. of arguments that can be given in a command line in C.?

766


What are the different types of linkage exist in c?

689


What kind of structure is a house?

643


what is the diffrenet bettwen HTTP and internet protocol

1474


what do you mean by enumeration constant?

686


What is structure in c explain with example?

739


Who invented bcpl language?

810


Hai sir, I had planned to write the NIC scientific engineer exam , plz post the sample question......

1846


Write a program to print “hello world” without using semicolon?

748


Explain how do you generate random numbers in c?

722