Question

Write a java program that compute the circumference and area of a circle from the user...

Write a java program that compute the circumference and area of a circle from the user input for a radius.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Area_and_Circumofcircle.java

    import java.util.Scanner;//keyboard inputting

    public class Area_and_Circumofcircle

    {//main class

        public static void main(String[] args)

        {//main method

            int r;

            double pi = 3.14, area,circumference;

            Scanner s = new Scanner(System.in);

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

            r = s.nextInt();//keyboard inputting

            area = pi * r * r;//area of circle
            circumference=2*pi*r;//circumference of circle

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

    }

output

Enter radius of circle:5
Area of circle:78.5
Circumference of circle31.400000000000002

Add a comment
Know the answer?
Add Answer to:
Write a java program that compute the circumference and area of a circle from the user...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT