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
Discuss different types of errors that generally occur while programming.
What are "methods" and "fields"?
How to avoid memory leak in java?
How many bits is a double?
What is defined as false sharing in the context of multithreading?
Explain JMS in detail.
Difference between concurrent hashmap and hashtable and collections
What is bubble sort in java?
How do you square a number?
What is enhanced loop in java?
What is the SimpleTimeZone class?
what invokes a threads run() method? : Java thread
Which command from the jdk compiles a java program?
What do you understand by java?
Are generics important java?