Thread Rating:
  • 1 Vote(s) - 2 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Help] Algoritma menghitung luas & keliling lingkaran
#7
(11-13-2011, 06:15 PM)genbu Wrote: cb jgn pake math.pow dolo pake manual rumus lingkaran... trus cb itu yg S.O.P(hasil) dimasukin di fungsi if nya

kk ini saya udah berhasil, tapi outputnya saya taruh satu-persatu di setiap if'nya.
saya pinginnya output cuman sekali aja di akhir, tapi entah knp itu selalu error

source :
PHP Code:
package belajar; import java.util.Scanner; public class LuasKllLingkaran { public static void main(String[] args) { Scanner input=new Scanner(System.in); System.out.println("Lingkaran : "); System.out.println("[1] Luas Lingkaran"); System.out.println("[2] Keliling Lingkaran\n"); double phi=3.14; double r,opsi,hasil; System.out.print("input jari-jari lingkaran : "); r=input.nextDouble(); System.out.print("input opsi aritmatika : "); opsi=input.nextDouble(); if (opsi==1){ hasil=phi*Math.pow(r,2); System.out.println("luas lingkaran : "+hasil); } else if (opsi==2){ hasil=2*phi*r; System.out.println("keliling lingkaran : "+hasil); } else { System.out.println("Error"); } } }

Reply


Messages In This Thread
RE: [Help] Algoritma menghitung luas & keliling lingkaran - by keda - 11-13-2011, 06:28 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Menghitung penjumlahan biner di C RieqyNS13 7 102 11-10-2013, 08:25 PM
Last Post: darkparkerz
Help_16 [ASK] Soal Algoritma Pemrogaman keda 9 167 11-10-2011, 09:55 PM
Last Post: genbu

Forum Jump:


Users browsing this thread: 1 Guest(s)