Tuesday, 16 April 2013

Jam Pasir Angka C++


#include<iostream.h>
main()
{
int a, b, c, d;
c=0;
for (a=4;a>=1;a--)
{
for (b=4;b>=a;b--)
{cout<<" ";}
for (b=a;b>=1;b--)
{c=c+1;
cout<<c<<" ";}
cout<<endl;}
c=10;
for (a=3;a>=1;a--)
{
for (b=1;b<=a;b++)
{cout<<" ";}
for (b=a;b<=4;b++)
{c=c-1;
cout<<c<<" ";}
cout<<endl;}}


No comments:

Post a Comment