//Muhammad Alditya Azizi
//22/492752/TK/53943
int r ;
int t ;
float v_silinder(int r, int t){
float v=3.14*r*r*t;
return v;
}
float v_bola(int r){
float v= (4/3)*3.14*r*r*r;
return v;
}
float v_silinder_tanpa_bola(int r, int t){
float v = v_silinder (r,t) - v_bola (r);
return v;
}
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
}
void loop() {
// put your main code here, to run repeatedly:
Serial.println("Masukkan nilai r:");
while (Serial.available() < 2);
r = Serial.parseInt();
Serial.println (r);
Serial.println("Masukkan nilai t:");
while (Serial.available() < 2 );
t = Serial.parseInt();
Serial.println (t);
Serial.print("Volume silinder: ");
Serial.println (v_silinder(r,t));
Serial.print("Volume bola dalam silinder: ");
Serial.println(v_bola(r));
Serial.print("Volume dalam silinder yang tidak ditempati bola: ");
Serial.println(v_silinder_tanpa_bola(r,t));
delay(5000);
}