Program to print 1
1 2
1 2 3
1 2 3 4 like that

Answer Posted / vivek

#include<iostream>
using namespace std;
int main()
{
int i,j,n,k;
cout<<"provide the no. of row";
cin>>n;
for(i=1; i<=n; i++)
{
k=n-i;
while(k>0)
{
cout<<" ";
k--;
}
for(j=1; j<i; j++)
cout<<" "<<j<< " ";
cout<<"\n";
}
return(0);
}

Is This Answer Correct ?    1 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Discuss different types of errors that generally occur while programming.

579


What are "methods" and "fields"?

575


How to avoid memory leak in java?

596


How many bits is a double?

532


What is defined as false sharing in the context of multithreading?

507






Explain JMS in detail.

614


Difference between concurrent hashmap and hashtable and collections

566


What is bubble sort in java?

615


How do you square a number?

583


What is enhanced loop in java?

548


What is the SimpleTimeZone class?

1799


what invokes a threads run() method? : Java thread

574


Which command from the jdk compiles a java program?

489


What do you understand by java?

563


Are generics important java?

524