answersLogoWhite

0


Best Answer

I'm not sure how you'd do this in C++, but I could have a go at it in php since that's what I know.

You know that Pi is approximately 22/7, in php you can use the pi function.

You'd need your input(radius) to come from a form if it was web-based, which is simple enough.

perimeter = 2nr = 2 x (22/7) x r

function getPerimeter ($input) {

$input = $_GET['formInput'];

$pi=pi();

$perimeter = (2*$pi)*$input;

return $perimeter;

}

HTH

User Avatar

Wiki User

14y ago
This answer is:
User Avatar
More answers
User Avatar

Wiki User

13y ago

I did a little dummy-proofing and added a loop so you can redo it as many times as you need to

var radius : string

var circumference : real

var radius_value : real

var retry : string

loop

loop

%getting the radius

put "Please give the radius of the circle"

get radius

%checking if the given radius will be ok

if strrealok (radius) then

exit

else

delay (500)

put "Please put a valid radius"

end if

end loop

%converting radius string to radius real

radius_value := strreal (radius)

%calculating circumference

circumference := radius_value*2*3.14

%outputting final results

delay (500)

put "The circumference of your circle is ",circumference, "(unit of measurement)"

delay (500)

put "Do you wish to calculate another answer? (y or n)"

get retry

if retry = "n" then

exit

end if

end loop

This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: In Turing write a program that prompts for the radius of a circle then calculates and outputs the circumference?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

Turbo c program that prompts user to try again?

puts ("Try again");


How do you write a function isVowel that returns the value true if given a vowel and otherwise returns false and prompts user to enter a sequence of characters and outputs the number of vowels?

bool isVowel(char c){if ((c 'u'))return true;elsereturn false ;}


How do you rip a CD to your computer?

You need a program that will do the ripping - the latest version of Windows Media Player does it. After that, select "Rip" or "Copy from CD" or something like that and folow the prompts.


How do you open C when it prompts you to choose the program to open it with with in a list?

edit your autorun.inf file, add the line open=C:\windows\explorer.exe good luck Kevin


How do I install engineering software to my computer?

To install engineering, or any other software to your computer, you first need to put the disc it comes on into the disc drive. Then, you should run the installer on the disc and follow the prompts onscreen. If it is a program that you've downloaded, start the .exe file that you downloaded and follow the prompts that it gives you.


What are some prompts for kids poems?

There are many sources of prompts for kids poems on the internet. Poetry4Kids and Scholastic both publish numerous prompts for kids poems on their websites.


Does vibe navigation unit have voice prompts?

yes is does have voice prompts. you have to increase the volume in the setup?


Do you have to stick to essay prompts?

no


How reset Toyota Sienna theft deterrent?

You need a computer program that can type command prompts to ECU. Look on Craig's for an auto locksmith under services that can program chipped keys and has ability to reset PATS and is mobile. It will cost about 100 and takes 5-10 mins.


Word that begins with the prefix mis and means prompts a kiss?

It doesn't MEAN "prompts a kiss," it DOES prompt a kiss, and it is mistletoe.


What prompts John Thornton and his partners to travel east and leave Dawson?

gold prompts john thorton to leave dawson


What does understanding writing prompts mean?

UTOT !!