Computer Science, asked by rachitkothadia98, 7 months ago

Write a menu driven program for the following 1. Circumference of circle(2*3.14*r) 2. Perimeter of triangle(a+b+c) java




you are great if u did this without spam

Answers

Answered by udayagrawal49
4

Answer:

1) import java.util.Scanner;

public class Main {

public static void main(String[] args) {

 try{

  System.out.print("Enter the radius of circle (in cm): ");

  Scanner scan = new Scanner(System.in);

  double radius = scan.nextDouble();

  scan.close();

  double cf = 2*3.14*radius;

  System.out.println("Circumference of circle with radius "+radius+" is "+cf+" cm");

 }

 catch (Exception e) {

  System.out.println("Some error occured");

 }

}

}

2) import java.util.Scanner;

public class Main {

public static void main(String[] args) {

 try{

  System.out.print("Enter the sides of triangle (in cm): ");

  Scanner scan = new Scanner(System.in);

  double a = scan.nextDouble();

  double b = scan.nextDouble();

  double c = scan.nextDouble();

  scan.close();

  double peri = a+b+c;

  System.out.println("Perimeter of triangle with sides "+a+" , "+b+" and "+c+" is "+peri+" cm");

 }

 catch (Exception e) {

  System.out.println("Some error occured");

 }

}

}

Please mark it as Brainliest.

Similar questions