Skip to content

Instantly share code, notes, and snippets.

@bossiernesto
Last active June 21, 2019 00:01
Show Gist options
  • Select an option

  • Save bossiernesto/b6f4eb4726e04fc402093548cb07c600 to your computer and use it in GitHub Desktop.

Select an option

Save bossiernesto/b6f4eb4726e04fc402093548cb07c600 to your computer and use it in GitHub Desktop.
package a;
import java.util.Scanner;
public class Main {
public final static double pi = 3.14;
public static void main(String[] args) {
int diametro;
double perimetro;
int perimetroInt;
Scanner entrada = new Scanner (System.in);
System.out.println("Ingrese diámetro de círculo");
diametro=entrada.nextInt();
perimetro=(int)(pi*diametro); //ESTÁ BIEN EL CASTING? Si
perimetroInt = (int) perimetro; //Otra opcion
System.out.println("El perímetro del círculo es: " + perimetroInt);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment