‫Hello my friends, and welcome to Coding Exercise number two.
‫In this exercise we are asked to write a program that gets from the user the radius and print the area
‫and perimeter of a circle.
‫Please pause the video and think about how to solve such a program.
‫I want from you to to paste in the comments your solution.
‫I hope you solve it well and correctly.
‫In order to get data from the user, we use var radius equal to scanner.
‫I need to get an object of the scanner dot or here I will create a scan S1 scanner dot set or scanner
‫dot system
‫system dot n.
‫Okay, this is the input string.
‫Now I will display a message for the user telling him to enter the radius.
‫Please enter the radius.
‫Okay.
‫So var radius.
‫I will store it inside a variable called radius s1 dot next int.
‫Okay.
‫Then I will make the calculation for this area and the perimeter.
‫I will create a double here.
‫Var perimeter equal to or of type double.
‫I will specify it double equal to.
‫Two times 3.14, which is pi 14, 15 times radius.
‫So two pi r this is the perimeter perimeter and the variable area of type double I will make equal to.
‫Radius times.
‫3.4, ten and 50.
‫This is pi.
‫The value of pi.
‫So the perimeter to pi r, the area is pi r square.
‫Okay, now let's display the area and the perimeter.
‫Result for the user.
‫I will check the area.
‫Area and the perimeter.
‫Perimeter.
‫Okay.
‫Now let's run the program and see.
‫Here we go.
‫Please enter the radius.
‫I will enter it as two.
‫The area is 12.56 and the perimeter is 12.566.
‫So if I open the calculator.
‫Oops.
‫Calculator
‫to pi
‫r will give me 12.566 which is the area.
‫Okay.
‫So everything is working fine.
‫And this is how we get a radius from the user and print the the area and the perimeter of this.