1
232
34543
4567654
567898765
67890109876
7890123210987
890123454321098
90123456765432109
0123456789876543210
#include"iostream"
using namespace std;
int main()
{
int a[19],k,n;
for(int k=1,n=1;n<=19;++k,n+=2)
{
for(int i =1;i<= (10-k);i++)
cout<<" ";
for( int i =0; i<k ;i++)
a[i]= a[n-i-1] =k+i;
for( int i =0;i<n;i++)
{
if( a[i]<10)cout << a[i];
else cout<< a[i]%10;
}
cout<<endl;
}
system("pause");
return 0;
}
Suu tam:
#include
main ()
{
int i,l, n,k, m;
for (i=0; i<=9; i++)
{
for (n=9-i; n>0; n--)
cout << " ";
n=i+1;
for (m=0; m<=2*i; m++)
{
if(n>9) n=n-10;
if (n<0) n=n+10;
if (m<i) {cout <<n; n++;}
else { cout <<n; n--;}
}
cout << endl;
}
system("pause");
return 0;
}
0 comments:
Post a Comment