Question 2.1
import java.util.Scanner;
public class ooplabweek1g2 {public static void main(String[] args) {
double celsius;
double fah;
Scanner input = new Scanner(System.in);
celsius = input.nextInt();
fah = (9/5) * celsius + 32;
System.out.println(fah);
}
}
Question 2.2
import java.util.Scanner;
public class ooplabweek1q2 {public static void main(String[] args) {
int radius, length;
double area,volume;
Scanner input = new Scanner(System.in);
System.out.println("sila masukkan nilai jejari dan panjang silinder:");
radius = input.nextInt();
length = input.nextInt();
area = radius*radius*3.14;
volume = area * length;
System.out.println("Isipadu silinder =:" + volume);
}
}
No comments:
Post a Comment