IJUL'S BLOG

Membuat Segitiga Angka

catatan kuliahq:
ni source code dari segitiga angka nya bro:

       #include<iostream.h>
        #include<stdio.h>
          int i,j,n,k;
          int M[1000];
          main()
          {
          cout<<"masukan angka : ";
          cin>>n;
          for (i=n ; i>=1 ; i--)
          {
          M[i]=i;
          }
          for (i=n ; i>=1 ; i--)
          {
          for (k=n,j=i; j>=1 ; k--,j--)
          {
          cout<<M[k];
          cout<<" ";
          }
          cout<<"\n";
          }
          for (i=2 ; i<=n ; i++)
          {
          for (k=n,j=1; j<=i ; j++,k--)
          {
          cout<<M[k];
          cout<<" ";
          }
          cout<<"\n";
          }
          }
 

0 komentar:

Posting Komentar

Powered By Blogger
Diberdayakan oleh Blogger.

Entri Populer

PENGUNJUNG

Buku Tamu

About Me

Foto Saya
Ijal Ferdi
there is no something special about me,,, but this blog is so special for me......
View my complete profile

Total Tayangan Halaman

Followers