You are on page 1of 8

Nama : Ferdinand Peres Alexander N

Kelas : 2KA03

NPM : 10120436

1. #include <iostream>

using namespace std;

int main()

cout << "## Program C++ Deret Angka ##" << endl;

cout << "===============================" << endl;

cout << endl;

int jumlah_deret,i;

cout << "Jumlah deret yang diinginkan: ";

cin >> jumlah_deret;

cout << endl;

for (i=0;i<=jumlah_deret;i++) {

cout << i*2 << " ";

}
cout << endl;

return 0;

}
2. #include <iostream>

using namespace std;

int main() {

int bil;

for(bil=10;bil>1;bil=bil-2)

printf("%d ", bil);

}
3. #include <iostream>
using namespace std;

int main() {

int bil;

for(bil=1;bil<10;bil=bil+2)

printf("%d ", bil);

}
4. #include <iostream>

using namespace std;


int main() {

int bil;

for(bil=9;bil>0;bil=bil-2)

printf("%d ", bil);

You might also like