importjava.util.Scanner;classKW{publicstaticvoidmain(Stringargs[]){floatr;Scannersc=newScanner(System.in);System.out.println("———————————————————————————————————————————");System.out.println("Program to calculate the area of circle ");System.out.println("———————————————————————————————————————————");System.out.print("Enter the radius of circle ");r=sc.nextFloat();System.out.println("Area of circle is "+(3.14*r*r));System.out.println("Circumference of circle is "+(2*3.14*r));System.out.println("———————————————————————————————————————————");}}
Output
kodingwindow@kw:~$ javac KW.java kodingwindow@kw:~$ java KW
———————————————————————————————————————————
Program to calculate the area of circle
———————————————————————————————————————————
Enter the radius of circle 10
Area of circle is 314.0
Circumference of circle is 62.800000000000004
———————————————————————————————————————————
kodingwindow@kw:~$
Dear User, Thank you for visitng KodingWindow. If you are interested in technical articles, latest technologies, and our journey further, please follow us on LinkedIn.