BENTUK HURUF SEGITIGA
#include<iostream.h>
#include<conio.h>
class segitiga
{
public :
void rumus();
};
void main()
{
segitiga x;
x.rumus();
getch();
}
void segitiga::rumus()
{
for(int i=1; i<=5; i++)
{
for(int j=1; j<=i; j++)
{
if(j==1)
{
for(int k=i; k<=5; k++)
{
cout<<" ";
}
}
cout<<i<<" ";
}
cout<<endl<<endl;
}
}
Tidak ada komentar:
Posting Komentar