Friday, January 20, 2017

Perimeter of Circle In Java

Tags

//Following will help you understand

import java.util.Scanner;
public class Perimeter
{
    public static void main(String [] nt)

    {  float x;
    Scanner input=new Scanner(System.in);
        System.out.println("Enter the radius of circle");
        x=input.nextFloat();
        float y;
                y=2*3.142f*x;      //because of float we have used f
                System.out.printf("Perimeter of Circle %f\n",y);
    }
}

Output: