1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
| public class NewClass {
public static void main(String args[]) {
float rayon;
double perimetre,surface;
System.out.println("saisir le rayon:");
// Scanner entree = new Scanner(System.in);
//rayon = Integer.parseInt(entree.nextLine());
try{
Scanner sc=new Scanner(System.in);
rayon = (sc.nextFloat());
// rayon=sc.nextFloat();
perimetre=2*Math.PI*rayon;
surface=Math.PI*Math.pow(rayon, 2.0);
System.out.println("le cercle de rayon est:"+rayon);
System.out.println("le perimetre est:"+perimetre);
System.out.println("le surface est:"+surface);
}
catch(Exception e){ System.out.println(e);
}
}
} |
Partager