Find Here !!!

Sunday, 23 March 2014

Bentuk FOR sederhana di program C++

Segitika Kosong

________________________________________________________

#include <iostream.h>

main ()
{
int a,b,c, x=5;

for (a=1;a<=5;a++)
{
cout << "* ";
}
cout << endl;


for (b=1;b<=3;b++)
{
for (c=1;c<=b;c++)
{
cout << " ";
}
cout <<"*";
for (int d=1;d<=x;d++)
{
cout << " ";
}
x=x-2;
cout << "*" << endl;


}
cout << "    *";
}
_______________________________________________________
  Semoga Berguna (y)

No comments:

Post a Comment