Problem
1.8
Write a
program that displays the area and perimeter
of
a circle
Description:
Using the following formula:
perimeter = 2 * radius
*
area = radius * radius *
Solution:
public class Message {
public static void main(String[] args) {
float pi=3.14f,radius=30;
System.out.println("The
paramiter of circle is
"+(2*pi*radius));
System.out.println("The area of
circle is "+(pi*radius*radius));
} }
Output:
No comments:
Post a Comment