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
| import javax.swing.JOptionPane;
class SeriParalel
{
public static void main(String[] args)
{
String nilai1s;
String nilai2s;
String nilai3s;
String nilai4s;
String nilai5s;
int nilai1;
int nilai2;
int nilai3;
int nilai4;
int nilai5;
double paralel; int seri;
nilai1s =JOptionPane.showInputDialog("Maukkan Nilai Pertama : ");
nilai1 =Integer.parseInt(nilai1s);
nilai2s =JOptionPane.showInputDialog("Maukkan Nilai Kedua : ");
nilai2 =Integer.parseInt(nilai2s);
nilai3s =JOptionPane.showInputDialog("Maukkan Nilai Ketiga : ");
nilai3 =Integer.parseInt(nilai3s);
nilai4s =JOptionPane.showInputDialog("Maukkan Nilai Keempat : ");
nilai4 =Integer.parseInt(nilai4s);
nilai5s =JOptionPane.showInputDialog("Maukkan Nilai Kelima : ");
nilai5 =Integer.parseInt(nilai5s);
seri = nilai1 + nilai2 + nilai3 + nilai4 + nilai5;
paralel = (1/(double)nilai1) + (1/(double)nilai2) + (1/(double)nilai3) + (1/(double)nilai4) + (1/(double)nilai5);
JOptionPane.showMessageDialog(null, "Perhitungn secara Seri : " + seri);
JOptionPane.showMessageDialog(null, "Perhitungn secara Paralel : " + paralel);
}
}
|
Tidak ada komentar:
Posting Komentar