In Turing write a program that prompts for the radius of a circle then calculates and outputs the circumference?

1 answer

Answer

1076668

2026-08-01 10:15

+ Follow

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

ReportLike(0ShareFavorite

Copyright © 2026 eLLeNow.com All Rights Reserved.