4

(1.8K
Views)

Hello Community. I am learning multiples programming languages. I want to find out the area of the circle in C programming, PHP programming, and C# programming languages. How can I get the area of circle these programming languages?

priyasharma4005 (4.3K Points)

in Programming 2 Answers

1

That's a really great idea if you want to compare three programming languages with the same example. If you want to get the area of the circle using C programming, PHP programming, and C# programming, you should understand the area of a circle formula. The mathematics formula for areal of the circle - A = **π** r^{2 }

**π - Pai **

**The value of π= 3.14 **

**Radius - r **

**Square of radius - r ^{2}**

The area of the circle can be written as pai*r*r in C, PHP, and C# programming.

C programming is known as the computer programming language. This is the base of all programming languages. If you want to learn any programming language,

you should understand the C language first.

You can find out the area of the circle in C language by creating variables and multiplication.

```
#include<stdio.h>
#include<math.h>
main()
{
float r=2.0;
float pai=3.14;
float a;
a = pai*r*r;
printf("Area of circle = %.2f\n", a);
}
```

Execute the above C language example and change the radius of the circle.

Let's find out the area of the circle in PHP.

```
<?php
$pai=3.14;
$r=2.0 ;
$a=$pai*$r*$r;
echo($a);
?>
```

In PHP, variables are declared with the dollar $ sign.

C# programming is another programming language based on C and C++ concepts. You can find out the area of a circle using the C# language.

```
public class areaOfCircle{
public static void Main(){
// Your code here!
double pai ,a,r;
pai=3.14;
r=2.0;
a=pai*r*r;
System.Console.WriteLine(a);
}
}
```

Comment

vishalrana1(7.3K Points)

answered (edited) 0

Thanks for the question. The solution is very easy. You should understand the basic things to find out the area of the circle using C, PHP, and C# programming languages.

Area of the circle = **π** r^{2 }

The value of the **π** = 3.14

r^{2= }r*r;

You need to create three variables.

Follow the best solution reference and change according to your need -

PHP: Add two input box values and sum in the third box

Follow for C# programming

Mathematics operations in C# programming

Area of the circle in C language -

```
#include<stdio.h>
#include<math.h>
main()
{
float rad=6,9;
float p=3.14;
float area;
area = p*rad*rad;
printf("Area of the circle = %.2f\n", area);
}
```

Comment

Your Answer

You can post your answer after