Computer Science, asked by joshikc2007, 3 months ago

write a program using function to compute area of the following and return the value from the function (a). area of circle:3.14*r*r, (b). area of square=side*side, (c). area of rectangle=length *breadth​

Answers

Answered by samridhsemwal1000
1

Answer:

This program is only for circles, you can take this program help to make others

Explanation:

import java.util.Scanner;

public class AreaOfCircleMethod

{

public static void main(String[] args)

{

Scanner sc = new Scanner(System.in);

System.out.println("Please enter radius : ");

double radius = sc.nextDouble();

// area of circle in java

double area = calculateArea(radius);

System.out.println("Area of circle : " + area);

sc.close();

}

static double calculateArea(double r)

{

return (22 * r * r) / 7;

}

}

Similar questions