SEGITIGA BORDER
#include <iostream.h>
#include <conio.h>
int main()
{
int ukuran;
do
{
cout<<"Masukkan ukuran persegi: ";
cin>>ukuran;
}while(ukuran<1||ukuran>20);
cout<<endl;
for(int i=1; i<= ukuran; i++)
{
for(int j=1; j<=ukuran; j++)
{
if(i==1||j==1||i==ukuran||j==ukuran)
{
cout<<"*";
}
else
{
cout<<" ";
}
}
cout<<endl;
}
getch();
return 0;
}
No comments:
Post a Comment