answersLogoWhite

0

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

16y ago

What else can I help you with?

Continue Learning about Engineering

Turbo c program that prompts user to try again?

puts ("Try again");


Write a Program in perl to convert given temperature from centigrade to Fahrenheit?

Here's a simple Perl program to convert temperature from Centigrade to Fahrenheit: #!/usr/bin/perl use strict; use warnings; print "Enter temperature in Centigrade: "; my $centigrade = <STDIN>; chomp($centigrade); my $fahrenheit = ($centigrade * 9/5) + 32; print "$centigrade°C is $fahrenheit°F\n"; This program prompts the user to enter a temperature in Centigrade, then calculates and displays the equivalent temperature in Fahrenheit using the conversion formula.


Write a FORTRAN code to calculating factorials?

Here is a simple FORTRAN code to calculate the factorial of a given non-negative integer: program factorial implicit none integer :: n, result print *, "Enter a non-negative integer:" read *, n result = 1 if (n < 0) then print *, "Factorial is not defined for negative numbers." else do i = 1, n result = result * i end do print *, "Factorial of", n, "is", result end if end program factorial This program prompts the user for an integer, checks if it's non-negative, and then calculates the factorial using a loop.


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


Write a program to aceept 5 numbers from keyboard n print itz total?

#include using std::cin;using std::cout;using std::endl;int main(){int arrSize = 5;double arr[arrSize] = {0.0};cout

Related Questions

output of a c program using function to find factorial of a number?

In a C program that calculates the factorial of a number using a function, the program typically prompts the user for an integer input. The function then recursively or iteratively computes the factorial by multiplying the number by the factorial of the number minus one until it reaches one. For example, if the user inputs 5, the program outputs 120, as 5! = 5 × 4 × 3 × 2 × 1. The final result is displayed on the screen.


How do you write a program in pascal to find area of a trapezium using pascal?

To write a program in Pascal to find the area of a trapezium, you can follow this structure: program AreaOfTrapezium; var a, b, height, area: real; begin writeln('Enter the lengths of the two parallel sides (a and b) and the height:'); readln(a, b, height); area := 0.5 * (a + b) * height; writeln('The area of the trapezium is: ', area:0:2); end. This program prompts the user for the lengths of the parallel sides and the height, calculates the area using the formula ( \text{Area} = 0.5 \times (a + b) \times \text{height} ), and then outputs the result.


What are ChatGPT prompts?

ChatGPT prompts are carefully crafted inputs or questions that guide the AI in generating meaningful, coherent, and relevant outputs. These prompts can be used for various tasks like writing, brainstorming, planning, and even personal development. For more details, you can visit our website:- Prinik Academy


Turbo c program that prompts user to try again?

puts ("Try again");


Write a C programme for area of rectangle?

Here's a simple C program to calculate the area of a rectangle: #include <stdio.h> int main() { float length, width, area; printf("Enter length of the rectangle: "); scanf("%f", &length); printf("Enter width of the rectangle: "); scanf("%f", &width); area = length * width; printf("Area of the rectangle: %.2f\n", area); return 0; } This program prompts the user to input the length and width, calculates the area, and then displays the result.


How can i write a BASIC programme using the convertion degree celsius to degree Fahrenheit?

To write a BASIC program that converts Celsius to Fahrenheit, you can use the following code snippet: 10 INPUT "Enter temperature in Celsius: ", C 20 F = (C * 9/5) + 32 30 PRINT "Temperature in Fahrenheit: "; F This program prompts the user to input a temperature in Celsius, calculates the equivalent in Fahrenheit using the formula ( F = (C \times \frac{9}{5}) + 32 ), and then displays the result.


Write a java program to find the factorial of a given number?

Here's a simple Java program to find the factorial of a given number using a recursive method: import java.util.Scanner; public class Factorial { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); System.out.print("Enter a number: "); int number = scanner.nextInt(); System.out.println("Factorial of " + number + " is " + factorial(number)); } static int factorial(int n) { return (n == 0) ? 1 : n * factorial(n - 1); } } This program prompts the user for a number and calculates its factorial recursively.


Write a FORTRAN code to calculating factorials?

Here is a simple FORTRAN code to calculate the factorial of a given non-negative integer: program factorial implicit none integer :: n, result print *, "Enter a non-negative integer:" read *, n result = 1 if (n < 0) then print *, "Factorial is not defined for negative numbers." else do i = 1, n result = result * i end do print *, "Factorial of", n, "is", result end if end program factorial This program prompts the user for an integer, checks if it's non-negative, and then calculates the factorial using a loop.


C prog to find squareroot?

To find the square root in C, you can use the sqrt function from the math.h library. Here’s a simple program: #include <stdio.h> #include <math.h> int main() { double number, result; printf("Enter a number: "); scanf("%lf", &number); result = sqrt(number); printf("Square root of %.2lf is %.2lf\n", number, result); return 0; } This program prompts the user for a number, calculates its square root, and prints the result. Make sure to link the math library when compiling with -lm.


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 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 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.