Easy C Program For Area Of Circle With Solution

Asked By 0 points N/A Posted on -
qa-featured

Why do we use float data type in C program for area of a circle? What is the mathematical equation for the area of a circle? What are the variables required?

SHARE
Answered By 0 points N/A #305779

Easy C Program For Area Of Circle With Solution

qa-featured

The float data type is used as we need to input floating values. The output will also have floating values as the value of pi=3.14. The formula for the area of the circle is 3.14*r*r, r is the radius. The variables required are r (radius), pi (3.14), c (area of the circle). This is one of the simplest programs in the C language as the source code is very less and can be written within ten lines.

Answered By 590275 points N/A #328283

Easy C Program For Area Of Circle With Solution

qa-featured

In C language or C programming, data types are used to define a variable before using in a program and C data type is the data storage format which allows a variable to store data to perform a specific operation. The C language has four (4) data types:

  • Basic data type – int, char, float, and double
  • Enumeration data type – enum
  • Derived data type – pointer, array, structure, and union
  • Void data type – void

Floating point data type has two (2) types:

  • Float
  • Double

With float data type, it allows a variable to store decimal values and has a storage size of 4. You can store values up to six (6) digits after the decimal point, for example, 10.456789. Double data type supports up to ten (10) digits after the decimal point and ranges from 1E–37 up to 1E+37.

Login/Register to Answer

Related Questions