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
How to perform bubble sort in java?
Is call by reference possible in java?
What is a condition in java?
In a program, initializing an array of 100 KB is throwing an out of memory exception while there is 100 MB of memory available. Why?
What is variable and example?
Can an interface have a constructor?
What is difference between wait and notify in java?
How can you make sure that your singleton class will always return single instance in multi-threaded environment?
What is lexicographically smallest string?
Can we have a try block without catch block?
what is encapsulation in java? Explain
What happens when heap memory is full?
What are the actions that can occur when a thread enters blocked state?
How can you avoid serialization in child class if the base class is implementing the serializable interface?
What do you mean by local variable and instance variable?