Saturday, May 25, 2013

praktikum alpro: contoh program segitiga bawah C++

#include <iostream>
#include <conio.h>
#include <iomanip>

using namespace std;

int main(int argc, char *argv[])
{
int a, b, c;
int angka;
int p;
c=1;
cout<<"\nMasukan Jumlah Data : ";cin>>angka;
cout<<"\n\n";
p = angka;
for(a=1;a<=p;a++)
{
cout<<setw(c);
for(b=1;b <=angka; b++)
{
cout<<" "<<angka;
}
c=c-1;
angka = angka + 1;
cout<<"\n";
}


        getch();
}


output:


No comments:

Post a Comment