in Education by
Write an algorithm to accept radius of a circle from user, and display area of the circle using the formula: area = 3.14 x radius x radius Select the correct answer from above options

1 Answer

0 votes
by
Explanation: Here we are writing a simple C program that calculates the area and circumference of circle based on the radius value provided by user. Formula: Area = 3.14 * radius * radius Circumference = 2 * 3.14 * radius Program to calculate Area and Circumference based on user input To calculate area and circumference we must know the radius of circle. The program will prompt user to enter the radius and based on the input it would calculate the values. To make it simpler we have taken standard PI value as 3.14 (constant) in the program. Other details are mentioned as comments in the below example program. #include int main() { int circle_radius; float PI_VALUE=3.14, circle_area, circle_circumf; //Ask user to enter the radius of circle printf(“\nEnter radius of circle: “); //Storing the user input into variable circle_radius scanf(“%d”,&circle_radius); //Calculate and display Area circle_area = PI_VALUE * circle_radius * circle_radius; printf(“\nArea of circle is: %f”,circle_area); //Caluclate and display Circumference circle_circumf = 2 * PI_VALUE * circle_radius; printf(“\nCircumference of circle is: %f”,circle_circumf); return(0); } Output: Enter radius of circle: 2 Area of circle is: 12.560000 Circumference of circle is: 12.560000 If you want more accurate results then take PI value as 22/7 instead of 3.14, it would give you the exact values of area and circumference.

Related questions

0 votes
    Write a program to accept a filename from the user and display all the lines from the file which contain python comment character ‘#’. Select the correct answer from above options...
asked Dec 21, 2021 in Education by JackTerrance
0 votes
0 votes
0 votes
    A circle tent is cylindrical uptown height of 15m and conical above it. If the radius of the base is 28 m and ... air inside the tent. Select the correct answer from above options...
asked Nov 26, 2021 in Education by JackTerrance
0 votes
    Write a program to accept string from user and search a given character from string without using find() function Select the correct answer from above options...
asked Nov 30, 2021 in Education by JackTerrance
0 votes
    write an algorithm to accept an integer number and print the factors of it Select the correct answer from above options...
asked Nov 27, 2021 in Education by JackTerrance
0 votes
    write a Java program to accept a full name and display the initials along with the surname. URGENT! give the full program please Select the correct answer from above options...
asked Dec 31, 2021 in Education by JackTerrance
0 votes
    write a program to accept a word and display the new word after removing all the repeated alphabet Select the correct answer from above options...
asked Dec 25, 2021 in Education by JackTerrance
0 votes
    write a program in java to accept a number and display the new number after removing all the zeros Select the correct answer from above options...
asked Dec 10, 2021 in Education by JackTerrance
0 votes
    look at the following function header for a member function void circle::Radius[ ] what is the name of the ... function a member of Select the correct answer from above options...
asked Dec 19, 2021 in Education by JackTerrance
0 votes
    Write a JAVA program to find the area and perimeter of a square and rectangle. Store side in s , length as ... USE ANY INPUT METHOD Select the correct answer from above options...
asked Dec 22, 2021 in Education by JackTerrance
0 votes
    Write a JAVA program to find the area and perimeter of a square and rectangle. Store side in s , length ... results in separate lines. Select the correct answer from above options...
asked Dec 21, 2021 in Education by JackTerrance
0 votes
    Write pseudo code to count occurrence of a given number in the list. For example, consider the following list, if ... in the list. Select the correct answer from above options...
asked Nov 28, 2021 in Education by JackTerrance
...