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
Can this keyword be used to refer static members?
Which class cannot be a subclass in java?
What is set and get methods in java?
What is void class in java?
Is node a data type in java?
What are the differences between wait() and sleep()?
What is unicode in java?
Class c implements interface I containing method m1 and m2 declarations. Class c has provided implementation for method m2. Can I create an object of class c?
What is the difference between == and === javascript?
What is the full meaning of java?
What does substring mean?
What is var keyword ?
What is sortedset in java?
What is string literal in java?
Enlist few advantages of inheritance?