Rabu, 02 Mei 2012

program for segitiga


#include <iostream>
#include <conio.h>
using namespace std;
main(){
 char ulang;
 awal :
int i,j,k,l,m=1,n;
cout<<"\n-------- SELAMAT DATANG --------"<<endl;
cout<<"\nSilahkan Masukan Angka [1..9] : ";
cin>>n;
cout<<"\n";
for (i=n;i>=1;i--){
for (j=1;j<=i;j++){
cout<<j<<" ";
}
for (l=1;l<=m;l++){
cout<<" ";}
for (k=i;k>=1;k--){
cout<<k<<" "; }
m=m+4;
cout<<endl;}
cout << "\nAnda Ingin Mencoba Lagi [Y/N] ? : "; cin >> ulang;
cout<<"\n";
system("cls");
 while(ulang=='Y'||ulang=='y')
 goto awal;
goto akhir;
getch();
akhir:
      return 0;
}

 




















lira elvani ; 2ka17 ; 14110044

Tidak ada komentar:

Posting Komentar