-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathejercicio18.java
More file actions
42 lines (27 loc) · 829 Bytes
/
ejercicio18.java
File metadata and controls
42 lines (27 loc) · 829 Bytes
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
39
40
41
42
package com.edu;
import java.util.Scanner;
public class ejercicio18 {
/*
18. Realizar un método llamado calcularAreaCirculo que devuelva el área de un círculo
y otro llamado calcularLongitudCirculo que devuelva su longitud.
*/
double radio;
double diametro;
public static void main(String[]args) {
System.out.println("Indica un radio ");
Scanner sc = new Scanner(System.in);
double radio = Double.valueOf(sc.nextDouble());
System.out.println(calcularAreaCirculo(radio));
System.out.println(calcularLongitudCirculo(radio));
}
public static double calcularAreaCirculo (double radio) {
double area;
area=3.14 * radio*radio;
return area ;
}
public static double calcularLongitudCirculo (double radio) {
double longitud;
longitud= 3.14 * 2*radio;
return longitud;
}
}