-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path5-loopingFor.cpp
More file actions
38 lines (33 loc) · 801 Bytes
/
5-loopingFor.cpp
File metadata and controls
38 lines (33 loc) · 801 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#include <iostream>
using namespace std;
int main(){
/*
looping / perulangan / repetition
1. for (counted loop)
2. while (counted loop & uncounted loop)
3. do while
4. do until, foreach, for in,
5. Nested For
*/
int i;
int tgl;
int bln;
int tahun;
for (i=1; i<=100; i++){
cout<< "Soal CPNS No." << i <<endl;
}
cout<<"=========================================="<<endl;
for(tgl=1; tgl<=30; tgl++){
cout<< "Tanggal:" << tgl <<endl;
}
cout<<"=========================================="<<endl;
for(bln=1; bln<=12; bln++){
cout<< "Bulan:" << bln <<endl;
}
cout<<"=========================================="<<endl;
for(tahun=2024; tahun>=2000; tahun--){
cout<< "Tahun:" << tahun <<endl;
}
cout<<"=========================================="<<endl;
return 0;
}