Closed roberthsu2003 closed 9 months ago
#include <iostream>
using namespace std;
int main() {
//巢狀迴圈
for (int i = 1; i < 10; i++) {
for (int j = 1; j < i; j++) {
cout << "#" ;
}
cout << endl;
}
}
#include <iostream>
using namespace std;
int main()
{
for(int i=1;i<=5;i++)
{
for(int j=1;j<=i;j++)
{
cout<<"#";
}
cout<<endl;
}
return 0;
}
#include <iostream>
using namespace std;
int main()
{
for(int i=0;i<5;i++)
{
for(int j=0;j<=i;j++)
{
cout << "#";
}
cout << endl;
}
return 0;
}
利用2層for迴圈列印「井」字,將其排列成直角三角形