Write and test a program that computes the area of a circle. Request a number representing a radius as input from the user. Use the formula 3.14 × radius2 to compute the area. Output this result with a suitable label.
Since you have not mentioned the language of your preference, I am providing the code in C++.
CODE
#include <iostream>
using namespace std;
int main() {
double radius;
cout << "Enter the radius of the circle: ";
cin >> radius;
cout << "The area of the circle is: " << 3.14 * radius * radius;
}
Write and test a program that computes the area of a circle. Request a number representing...
Instructions circle.py + >- Terminal 1 # Put your code here 2 Write and test a program that computes the area of a circle. 1. Request a number representing a radius as input from the user 2. Use the formula 3.14 radius? to compute the area. 3. Output this result with a suitable label An example of the program input and output is shown below: Enter the radius: 5 The area is 78.5 square units
Write a shell script that given a radius, calculates the area of a circle. (Hint – don’t write this from scratch. Find another script that reads user input and performs a calculation, then modify it to meet your needs.) Save the script in your home directory with the name circle.sh The formula for calculating the area is: Area=Π*Radius2 You can use 3.14 for Π, and either do Radius*Radius or Radius^2 to get the square of the radius. Use the scale...
1. Write a program that determines the area and perimeter of a square. Your program should accept the appropriate measurement of the square as input from the user and display the result to the screen. Area of Square = L (squared) Perimeter of Square = 4 * L 2. Write a program that determines the area and circumference of a circle. Your program should accept the appropriate measurement of the circle as input from the user and display the result to...
Java Write a program that prompt the user to enter a decimal number representing the radius of a circle. If the number is greater or equal to zero, the program displays the area of the circle. Otherwise, the program displays “negative input”
Write a java program that compute the circumference and area of a circle from the user input for a radius.
Write a Perl program that computes the circumference of a circle. Your program prompts for and accepts a radius from the person running the program. So, if the user enters 12.5 for the radius, she should get the answer about 78.5. Circumference is 2π times the radius (approximately 2 times 3.141592654).
Write a program that calculates the area and circumference of a circle. It should ask the user first to enter the number of circles n, then reads the radius of each circle and stores it in an array. The program then finds the area and the circumference, as in the following equations, and prints them in a tabular format as shown in the sample output. Area = πr2 , Circumference = 2πr, π = 3.14159 Sample Output: Enter the number...
Write a Python program that computes the volume of a sphere with a radius of 5. The formula for a sphere is 4⁄3πr3. Write a function sphere_volume that returns the volume of a sphere when given radius r as a parameter. Then write a main program that calls sphere_volume by passing an argument after getting it as an input from the user.
Using the algorithm information below, program a calculator for the area and circumference of a circle. Answer in C LANGUAGE !! Algorithm for Area and Circumference of a Circle: Inputs: - radius of the circle Outputs: - the area of the circle - the circumference of the circle Relevant Constants and Formulas: - area of a circle = PI x Radius x Radius - circumference of a circle = 2 x PI X Radius Main Algorithm (numbered steps) 1. Input...
Write a program that computes the Fibonacci number for some input integer. (See segments 7.37 – 7.41 in your book for some info on the Fibonacci sequence or you can look it up on the Internet). The sequence is defined as the first two elements are each 1, after that each element in the sequence is the sum of the previous two elements. The first few numbers of the sequence are 1,1,2,3,5,8,13,21,34,55,… Your assignment is to write a program with...