AREA AND PERIMETER OF CIRCLE
//find area of circle and perimeter of circle.
package com.company;
import java.util.Scanner;
import java.io.*;
public class Main {
public static void main(String[] args) {
float radius;
Scanner input = new Scanner(System.in);
System.out.print("Enter radius of circle : ");
radius= input.nextFloat();
double area,perimeter;
area = Math.PI*(radius*radius);
perimeter = 2*Math.PI*radius;
System.out.println("Area of circle is : "+area);
System.out.println("Perimeter of circle is :"+perimeter);
}
}
Enter radius of circle : 12
12.0
Area of circle is : 452.3893421169302
Perimeter of circle is :75.39822368615503
Process finished with exit code 0
Comments
Post a Comment