Membuat segitiga di C++
<code>
#include <iostream>
using namespace std;
int main()
{
for (int a=0; a<8; a++){
if (a==0){
for (int b=0; b<=8; b++){
cout<<b<<" ";
}
}
else{
cout<<a<<" ";
for (int k=1; k<=a; k++){
cout<<k*a<<" ";
}
}
cout<<endl;
}
return 0;
}
</code>
Komentar
Posting Komentar