Java Program to Calculate Perimeter of a Circle

You are currently viewing Java Program to Calculate Perimeter of a Circle

Java program to Calculate Perimeter of a Circle

//Java program to Calculate Perimeter of a Circle.

import java.util.Scanner;

public class PerimeterCircle {

  public static void main(String[] args) {

    double radius;
    Scanner sc = new Scanner(System.in);

    // input radius of circle
    System.out.print("Enter the Radius of Circle : ");
    radius = sc.nextDouble();

    // circle parameter is 2 * pie * radius 
    double Perimeter = 2 * 3.14 * radius;

    System.out.print("Perimeter of Circle : " + Perimeter);

  }

}

Output

    
    Enter the Radius of Circle : 3.5
    Perimeter of Circle : 21.98

Ranjith

Hi, I'm Manoj a full-time Blogger, YouTuber, Affiliate Marketer, & founder of Coding Diksha. Here, I post about programming to help developers.

Leave a Reply