Find Here !!!

Thursday, 20 March 2014

Program C++ menggunakan FOR untuk membuat Double Segitiga

Double Segitiga 

________________________________________________________
#include <iostream.h>

main()
{
int i,j,x ;
 cout<<"Masukkan Tinggi : ";
 cin>>x;
for (i=1;i<=x;i++)
  {
  for (j=1;j<=i;j++)
 {
cout<<j<<" ";}cout<<endl;
}



 for (i=1;i<=x;i++)
  {
  for (j=x;j>=i;j--)
 {
cout<<j<<" ";}cout<<endl;
}
 }
________________________________________________________

 Semoga Bermanfaat (y)

No comments:

Post a Comment