Tuesday, 16 April 2013

Piramida Angka C++


#include <iostream.h>
main()
{
int a, b, c, d, e, f;
cout<<"Input = ";
cin>>a;
for (b=1;b<=a;b++)
{
for (c=a;c>=b;c--)
{cout<<" ";}
for (d=1;d<=b;d++)
{cout<<d;}
for (e=b;e>=1;e--)
{f=e-1;
if (f==0)
break;
cout<<f;}
cout<<endl;}
}

No comments:

Post a Comment