Search

Sabtu, 14 April 2012

Flush Right Triangle

Today I will share the coding of the basic programming using Borland C + +, may be useful for the friend my friend as well.


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