satriafu5710

Luas & Volume Tabung Java

Dec 7th, 2020 (edited)
255
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.74 KB | None | 0 0
  1. package com.tutorial;
  2. import java.util.Scanner;
  3. public class Main {
  4.    
  5.     public static void main(String[] args) {
  6.        
  7.         Scanner userInput = new Scanner(System.in);
  8.  
  9.         float phi = 3.14f;
  10.         float r, tinggi, luasP, volume;
  11.  
  12.         System.out.println("\t Hitung Luas Permukaan dan Volume Tabung \n\n");
  13.  
  14.         System.out.print(" Masukkan Jari-jari  : ");
  15.         r = userInput.nextFloat();
  16.  
  17.         System.out.print(" Masukkan Tinggi     : ");
  18.         tinggi = userInput.nextFloat();
  19.  
  20.         luasP = 2 * phi * r * (r + tinggi);
  21.         System.out.println("\n Luas Permukaannya : " + luasP);
  22.  
  23.         volume = phi * r * r * tinggi;
  24.         System.out.println(" Volume Tabungnya    : " + volume);
  25.     }
  26. }
  27.  
Add Comment
Please, Sign In to add comment