The length & breadth of a rectangle and radius of a circle are input through the keyboard. Write a program to calculate the area & perimeter of the rectangle, and the area & circumference of the circle.
Overall, this program is a basic example of how Java can be used to perform simple mathematical operations and input/output operations, specifically for calculating the areas and perimeters of rectangles and circles.
import java.util.Scanner; class Calculate_Rectangle_Circle { public static void main(String args[]) { Scanner input = new Scanner(System.in); System.out.println("Enter the Length , Circle and Radius :"); float len = input.nextInt(); float bre = input.nextInt(); float rad = input.nextInt(); float area_rect = (len*bre); float per_rect = (2*(len+bre)); float area_cir = (3.14f*rad*rad); float circum_cir = (2*3.14f*rad); System.out.println("Area of Rectangle : "+area_rect); System.out.println("Perimeter of Rectangle : "+per_rect); System.out.println("Area of Circule : "+area_cir); System.out.println("Circum of a Circule : "+circum_cir); } }
Enter the Length , Circle and Radius : 12 34 9 Area of Rectangle : 408.0 Perimeter of Rectangle : 92.0 Area of Circule : 254.34 Circum of a Circule : 56.52
Learn All in Tamil © Designed & Developed By Tutor Joes | Privacy Policy | Terms & Conditions