Skip to content

Instantly share code, notes, and snippets.

@sameerkumar18
Last active November 28, 2015 06:37
Show Gist options
  • Select an option

  • Save sameerkumar18/46d0840afc1980042d92 to your computer and use it in GitHub Desktop.

Select an option

Save sameerkumar18/46d0840afc1980042d92 to your computer and use it in GitHub Desktop.
display array by removing one zero while looping like Output 9654321 9654320 9654300 9654000 9650000
/*Programmed by www.fb.com/sameer18051998*/
#include<iostream.h>
#include<conio.h>
void func(int[] , int);
void main()
{ clrscr();
int m,a1[20];
cout<<"\nEnter The Size Of The Array (Max. 20) \n";
cin>>m;
cout<<"\nEnter The Array \n";
for(int i=0;i<m;i++)
cin>>a1[i];
func(a1,m);
getch();
}
void func(int arr[],int size)
{ int a2[20][20];
int i,j;
for(i=0;i<size;i++)
{
for(j=0;j<size;j++)
{
if((i+j)>=size)
a2[i][j]=0;
else
a2[i][j]=arr[j];
cout<<a2[i][j]<<"";
}
cout<<"\n";
}
}
/*Programmed by www.fb.com/sameer18051998*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment