-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1db5c76
commit fd734cd
Showing
62 changed files
with
2,506 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
#include <iostream> | ||
using namespace std; | ||
|
||
int main() | ||
{ | ||
int x=10,y=33,z=0; | ||
cout << "Inisialisasi" << endl; | ||
cout << "x=" << x << endl; | ||
cout << "y=" << y << endl; | ||
cout << "z=" << z << endl; | ||
|
||
z=x; | ||
cout << "Pertukaran Pertama" << endl; | ||
cout << "x=" << x << endl; | ||
cout << "y=" << y << endl; | ||
cout << "z=" << z << endl; | ||
|
||
x=y; | ||
cout << "Pertukaran Kedua" << endl; | ||
cout << "x=" << x << endl; | ||
cout << "y=" << y << endl; | ||
cout << "z=" << z << endl; | ||
|
||
y=z; | ||
cout << "Pertukaran Ketiga" << endl; | ||
cout << "x=" << x << endl; | ||
cout << "y=" << y << endl; | ||
cout << "z=" << z << endl; | ||
|
||
system("pause"); | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#include <iostream> | ||
using namespace std; | ||
|
||
int main() | ||
{ | ||
int a; | ||
float jumlah=0; | ||
cout << "Masukan nilai = "; | ||
cin >> a; | ||
|
||
if(a>10) | ||
{ | ||
jumlah=jumlah+a; | ||
} | ||
else | ||
{ | ||
jumlah=jumlah-a; | ||
} | ||
cout << "Jumlah = " << jumlah << endl; | ||
|
||
system("pause"); | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#include <iostream> | ||
using namespace std; | ||
|
||
int main() | ||
{ | ||
int input; | ||
cout << "Masukan hari ke="; | ||
cin >> input; | ||
|
||
if(input==1) | ||
{ cout << "Hari Senin\n"; } | ||
else if(input==2) | ||
{ cout << "Hari Selasa\n"; } | ||
else if(input==3) | ||
{ cout << "Hari Rabu\n"; } | ||
else if(input==4) | ||
{ cout << "Hari Kamis\n"; } | ||
else if(input==5) | ||
{ cout << "Hari Jumat\n"; } | ||
else if(input==6) | ||
{ cout << "Hari Sabtu\n"; } | ||
else if(input==7) | ||
{ cout << "Hari Minggu\n"; } | ||
else | ||
{ cout << "Salah input\n"; } | ||
|
||
system("pause"); | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
#include <iostream> | ||
using namespace std; | ||
|
||
int main() | ||
{ | ||
int input; | ||
cout << "Masukan hari ke-"; | ||
cin >> input; | ||
|
||
switch(input) | ||
{ | ||
case 1: cout << "Hari Minggu\n"; | ||
break; | ||
case 2: cout << "Hari Senin\n"; | ||
break; | ||
case 3: cout << "Hari Selasa\n"; | ||
break; | ||
case 4: cout << "Hari Rabu\n"; | ||
break; | ||
case 5: cout << "Hari Kamis\n"; | ||
break; | ||
case 6: cout << "Hari Jumat\n"; | ||
break; | ||
case 7: cout << "Hari Sabtu\n"; | ||
break; | ||
default: cout << "Salah input\n"; | ||
break; | ||
} | ||
|
||
system("pause"); | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#include <iostream> | ||
using namespace std; | ||
|
||
int main() | ||
{ | ||
int input; | ||
cout << "Masukan hari ke-"; | ||
cin >> input; | ||
|
||
switch(input) | ||
{ | ||
case 1: cout << "Hari Minggu\n"; | ||
case 2: cout << "Hari Senin\n"; | ||
case 3: cout << "Hari Selasa\n"; | ||
case 4: cout << "Hari Rabu\n"; | ||
case 5: cout << "Hari Kamis\n"; | ||
case 6: cout << "Hari Jumat\n"; | ||
case 7: cout << "Hari Sabtu\n"; | ||
default: cout << "Salah input\n"; | ||
} | ||
|
||
system("pause"); | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
#include <iostream> | ||
using namespace std; | ||
|
||
int main() | ||
{ | ||
int x; | ||
cout << "Masukan Nilai Anda="; | ||
cin >> x; | ||
|
||
if(x>=85) | ||
{ | ||
cout << "A" << endl; | ||
} | ||
else if(x>=70) | ||
{ | ||
cout << "B" << endl; | ||
} | ||
else if(x>=40) | ||
{ | ||
cout << "C" << endl; | ||
} | ||
else if(x>=20) | ||
{ | ||
cout << "D" << endl; | ||
} | ||
else | ||
{ | ||
cout << "E" << endl; | ||
} | ||
|
||
system("pause"); | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#include <iostream> | ||
using namespace std; | ||
|
||
int main() | ||
{ | ||
int x,y,z=0; | ||
cout << "Masukan jumlah angka yang ingin ditampilkan= "; | ||
cin >> x; | ||
|
||
for(y=1;y<=x;y++) | ||
{ | ||
z=z+1; | ||
cout << z << " "; | ||
} | ||
|
||
cout << " \n"; | ||
system("pause"); | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#include <iostream> | ||
#include <string.h> | ||
using namespace std; | ||
|
||
int main() | ||
{ | ||
int x,z=1; | ||
char y; | ||
cout << "Masukan jumlah huruf yang ingin ditampilkan= "; | ||
cin >> x; | ||
|
||
for(y='A';z<=x;y++) | ||
{ | ||
cout << y << " "; | ||
z=z+1; | ||
} | ||
|
||
cout << " \n"; | ||
system("pause"); | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
#include <iostream> | ||
using namespace std; | ||
|
||
int main() | ||
{ | ||
int limit,star1,star2,star3,x,y,i; | ||
cin >> limit; | ||
cout << "STAR 1" << endl; | ||
for(star1=1;star1<=limit;star1++) | ||
{ | ||
x=limit-star1; | ||
y=0; | ||
while(x>0) | ||
{ | ||
cout << " "; | ||
x--; | ||
} | ||
while(y<star1) | ||
{ | ||
cout << "* "; | ||
y++; | ||
} | ||
cout << endl; | ||
} | ||
cout << endl; | ||
cout << "STAR 2" << endl; | ||
for(star2=1;star2<=limit;star2++) | ||
{ | ||
x=1; | ||
y=0; | ||
while(x<star2) | ||
{ | ||
cout << " "; | ||
x++; | ||
} | ||
while(y<=limit-star2) | ||
{ | ||
cout << "* "; | ||
y++; | ||
} | ||
cout << endl; | ||
} | ||
cout << endl; | ||
cout << endl; | ||
cout << "STAR 3" << endl; | ||
for(star1=1;star1<limit;star1++) | ||
{ | ||
x=limit-star1; | ||
y=0; | ||
while(x>0) | ||
{ | ||
cout << " "; | ||
x--; | ||
} | ||
while(y<star1) | ||
{ | ||
cout << "* "; | ||
y++; | ||
} | ||
cout << endl; | ||
} | ||
for(star2=1;star2<=limit;star2++) | ||
{ | ||
x=1; | ||
y=0; | ||
while(x<star2) | ||
{ | ||
cout << " "; | ||
x++; | ||
} | ||
while(y<=limit-star2) | ||
{ | ||
cout << "* "; | ||
y++; | ||
} | ||
cout << endl; | ||
} | ||
cout << endl; | ||
|
||
system("pause"); | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
#include <iostream> | ||
using namespace std; | ||
|
||
int main() | ||
{ | ||
int x,y,z=0,a=0,c=1,d=0; | ||
cout << "Masukan batas tabel perkalian yang ingin ditampilkan= "; | ||
cin >> x; | ||
|
||
cout << "*" << " "; | ||
for(y=1;y<=x;y++) | ||
{ | ||
z=z+1; | ||
cout << z << " "; | ||
} | ||
cout << " \n"; | ||
while(c<=x) | ||
{ | ||
d=d+1; | ||
int b=1; | ||
if(d>9) | ||
{ | ||
cout << d << " "; | ||
} | ||
else | ||
{ | ||
cout << d << " "; | ||
} | ||
for(y=1;y<=x;y++) | ||
{ | ||
a=d*b; | ||
if(a>9) | ||
{ | ||
cout << a << " "; | ||
} | ||
else | ||
{ | ||
cout << a << " "; | ||
} | ||
b=b+1; | ||
} | ||
c=c+1; | ||
cout << " \n"; | ||
} | ||
|
||
system("pause"); | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#include <iostream> | ||
using namespace std; | ||
|
||
int main() | ||
{ | ||
int input,n,a,b,x=0,y=0,sum=0; | ||
cout << "Masukan jumlah angka yang ingin dihitung= "; | ||
cin >> n; | ||
int plus[n]; | ||
for(x=0;x<n;x++) | ||
{ | ||
cin >> plus[x]; | ||
} | ||
for(x=0;x<n;x++) | ||
{ | ||
sum=sum+plus[x]; | ||
} | ||
cout << sum << endl; | ||
|
||
system("pause"); | ||
return 0; | ||
} |
Oops, something went wrong.