Flush Right Triangle
#include <iostream.h>
#include <conio.h>
void main(){
int i,j,k,n,l;
cout<<"Masukan Bil : ";cin>>n;
for (i=1;i<=n;i++){
if (i==1)
{
for (j=1;j<=n;j++)
{
cout<<"*";
}
}
if (i>=2){
for (k=1;k<i;k++)
{
cout<<" ";
}
for (l=i;l<=n;l++)
{
cout<<"*";
}
}
cout<<endl;
}
getch();
}
good luck with my friends :)
Tidak ada komentar:
Posting Komentar