//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:
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: