![Page 1: Nama :Rheza Ariyanto Kelas :TKJ 1B · Kelas :TKJ 1B . Latihan Soal 1.A. Bahasa C++ #include #include using namespace std; main { int p, q, r; p=5;](https://reader030.vdocuments.us/reader030/viewer/2022021723/5c80448a09d3f2a2228ca1fa/html5/thumbnails/1.jpg)
Latihan 4 Looping
Nama :Rheza Ariyanto
Kelas :TKJ 1B
![Page 2: Nama :Rheza Ariyanto Kelas :TKJ 1B · Kelas :TKJ 1B . Latihan Soal 1.A. Bahasa C++ #include #include using namespace std; main { int p, q, r; p=5;](https://reader030.vdocuments.us/reader030/viewer/2022021723/5c80448a09d3f2a2228ca1fa/html5/thumbnails/2.jpg)
Latihan Soal 1.A
![Page 3: Nama :Rheza Ariyanto Kelas :TKJ 1B · Kelas :TKJ 1B . Latihan Soal 1.A. Bahasa C++ #include #include using namespace std; main { int p, q, r; p=5;](https://reader030.vdocuments.us/reader030/viewer/2022021723/5c80448a09d3f2a2228ca1fa/html5/thumbnails/3.jpg)
![Page 4: Nama :Rheza Ariyanto Kelas :TKJ 1B · Kelas :TKJ 1B . Latihan Soal 1.A. Bahasa C++ #include #include using namespace std; main { int p, q, r; p=5;](https://reader030.vdocuments.us/reader030/viewer/2022021723/5c80448a09d3f2a2228ca1fa/html5/thumbnails/4.jpg)
![Page 5: Nama :Rheza Ariyanto Kelas :TKJ 1B · Kelas :TKJ 1B . Latihan Soal 1.A. Bahasa C++ #include #include using namespace std; main { int p, q, r; p=5;](https://reader030.vdocuments.us/reader030/viewer/2022021723/5c80448a09d3f2a2228ca1fa/html5/thumbnails/5.jpg)
Bahasa C++
#include <iostream>
#include <iomanip.h>
using namespace std;
main ()
{
int p, q, r;
p=5;
cout<<"Latihan Soal 1.a\n\n";
for (q=p; q>=2; q--)
{
cout<<setw(q);
for (r=q; r<=p; r++)
{
cout<<"*";
}
for (r=q+1; r<=p; r++)
{
cout<<"*";
}
cout<<'\n';
}
![Page 6: Nama :Rheza Ariyanto Kelas :TKJ 1B · Kelas :TKJ 1B . Latihan Soal 1.A. Bahasa C++ #include #include using namespace std; main { int p, q, r; p=5;](https://reader030.vdocuments.us/reader030/viewer/2022021723/5c80448a09d3f2a2228ca1fa/html5/thumbnails/6.jpg)
for (q=3; q<=p; q++)
{
cout<<setw(q);
for (r=p; r>=q; r--)
{
cout<<"*";
}
for (r=p-1; r>=q; r--)
{
cout<<"*";
}
cout<<'\n';
}
cout<<'\n';
system ("pause");
return 0;
}
Hasilnya
![Page 7: Nama :Rheza Ariyanto Kelas :TKJ 1B · Kelas :TKJ 1B . Latihan Soal 1.A. Bahasa C++ #include #include using namespace std; main { int p, q, r; p=5;](https://reader030.vdocuments.us/reader030/viewer/2022021723/5c80448a09d3f2a2228ca1fa/html5/thumbnails/7.jpg)
Latihan Soal 1.B
![Page 8: Nama :Rheza Ariyanto Kelas :TKJ 1B · Kelas :TKJ 1B . Latihan Soal 1.A. Bahasa C++ #include #include using namespace std; main { int p, q, r; p=5;](https://reader030.vdocuments.us/reader030/viewer/2022021723/5c80448a09d3f2a2228ca1fa/html5/thumbnails/8.jpg)
![Page 9: Nama :Rheza Ariyanto Kelas :TKJ 1B · Kelas :TKJ 1B . Latihan Soal 1.A. Bahasa C++ #include #include using namespace std; main { int p, q, r; p=5;](https://reader030.vdocuments.us/reader030/viewer/2022021723/5c80448a09d3f2a2228ca1fa/html5/thumbnails/9.jpg)
Bahasa C++
#include <iostream>
#include <iomanip.h>
using namespace std;
main ()
{
int p, q, r;
p=5;
cout<<"Latihan Soal 1.b\n\n";
for (q=p; q>=2; q--)
{
cout<<setw(q);
for (r=q; r<=p; r++)
{
cout<<"*";
}
for (r=q+1; r<=p; r++)
{
cout<<"*";
}
![Page 10: Nama :Rheza Ariyanto Kelas :TKJ 1B · Kelas :TKJ 1B . Latihan Soal 1.A. Bahasa C++ #include #include using namespace std; main { int p, q, r; p=5;](https://reader030.vdocuments.us/reader030/viewer/2022021723/5c80448a09d3f2a2228ca1fa/html5/thumbnails/10.jpg)
cout<<'\n';
}
cout<<'\n';
system ("pause");
return 0;
}
Hasilnya
![Page 11: Nama :Rheza Ariyanto Kelas :TKJ 1B · Kelas :TKJ 1B . Latihan Soal 1.A. Bahasa C++ #include #include using namespace std; main { int p, q, r; p=5;](https://reader030.vdocuments.us/reader030/viewer/2022021723/5c80448a09d3f2a2228ca1fa/html5/thumbnails/11.jpg)
Latihan Soal 1.C
![Page 12: Nama :Rheza Ariyanto Kelas :TKJ 1B · Kelas :TKJ 1B . Latihan Soal 1.A. Bahasa C++ #include #include using namespace std; main { int p, q, r; p=5;](https://reader030.vdocuments.us/reader030/viewer/2022021723/5c80448a09d3f2a2228ca1fa/html5/thumbnails/12.jpg)
![Page 13: Nama :Rheza Ariyanto Kelas :TKJ 1B · Kelas :TKJ 1B . Latihan Soal 1.A. Bahasa C++ #include #include using namespace std; main { int p, q, r; p=5;](https://reader030.vdocuments.us/reader030/viewer/2022021723/5c80448a09d3f2a2228ca1fa/html5/thumbnails/13.jpg)
![Page 14: Nama :Rheza Ariyanto Kelas :TKJ 1B · Kelas :TKJ 1B . Latihan Soal 1.A. Bahasa C++ #include #include using namespace std; main { int p, q, r; p=5;](https://reader030.vdocuments.us/reader030/viewer/2022021723/5c80448a09d3f2a2228ca1fa/html5/thumbnails/14.jpg)
Bahasa C++
#include <iostream>
#include <iomanip.h>
using namespace std;
main ()
{
int p, q, r;
p=5;
cout<<"Latihan Soal 1.c\n\n";
for (q=p; q>=2; q--)
{
for (r=q; r<=p; r++)
{
cout<<"*";
}
for (r=q+1; r<=p; r++)
{
cout<<"*";
}
cout<<'\n';
![Page 15: Nama :Rheza Ariyanto Kelas :TKJ 1B · Kelas :TKJ 1B . Latihan Soal 1.A. Bahasa C++ #include #include using namespace std; main { int p, q, r; p=5;](https://reader030.vdocuments.us/reader030/viewer/2022021723/5c80448a09d3f2a2228ca1fa/html5/thumbnails/15.jpg)
}
for (q=3; q<=p; q++)
{
for (r=p; r>=q; r--)
{
cout<<"*";
}
for (r=p-1; r>=q; r--)
{
cout<<"*";
}
cout<<'\n';
}
cout<<'\n';
system ("pause");
return 0;
}
![Page 16: Nama :Rheza Ariyanto Kelas :TKJ 1B · Kelas :TKJ 1B . Latihan Soal 1.A. Bahasa C++ #include #include using namespace std; main { int p, q, r; p=5;](https://reader030.vdocuments.us/reader030/viewer/2022021723/5c80448a09d3f2a2228ca1fa/html5/thumbnails/16.jpg)
Hasilnya