Question
Program to calculate the perimeter of the circle.
Share code with your friends
Share on whatsapp
Share on facebook
Share on twitter
Share on telegram
Code
import java.util.Scanner;
public class perimeterOfCircle
{
public static void main(String args[])
{
Scanner sc=new Scanner(System.in);
System.out.println("Enter radius of circle");
double r=sc.nextDouble();
double pi=22/7;
/*Formula of perimeter of circle =2*pi*radius of circle */
double perimeter=2*pi*r;
System.out.println("perimeter of circle="+perimeter);
}
}