import java.util.*;
public class JavaBasics {
// code to calculate area of a circle: area = 3.14 x radius x radius.
public static void main(String args[]) {
Scanner sc = new Scanner(System.in);
float radius = sc.nextFloat();
float area = 3.14f*radius*radius;
System.out.println(area);
}
}
MyLearnings:-
1. input f after 3.14, so 3.14 to avoid any floating errors
No comments:
Post a Comment