//Downloaded From theonlinetutorials.com
//(C)2011.All rights reserved.
/*
4 3 2 1
0 3 2 1
0 0 2 1
0 0 0 1
*/
#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
int i,n,g,j,a[100],b[100][100];
cout<<"Enter Limit"<<endl;
cin>>n;
cout<<"Enter "<<endl;
for(g=0;g<n;g++)
cin>>a[g];
for(i=0;i<n;i++)
{
for(j=n-1;j>=0;j--)
{
b[i][j]=a[j];
}
}
for(i=0;i<n;i++)
{
for(j=0;j<n;j++)
{
if(i>j)
b[i][j]=0;
}
}
for(i=0;i<n;i++)
{
cout<<endl;
for(j=0;j<n;j++)
{
cout<<b[i][j]<<" ";
}
}
getch();
}
Not Satisfied ? Just search & get the result
Related posts:
- C++ Program – Insert & Delete an element from array
- Sample – Program to enter 10 integers in a single-dimension array and then print out the array in ascending order.
- C++ Program – Display diamond and pascals triangle
- C++ Program – Simple & Compound Interest
- C++ Program – Array Based Representation of Linear List using templates
