Fractional Data Types and Constants – CSKC
Sign In

Search

Code Learning #CPP#7591    siteicon   siteicon  

Fractional Data Types and Constants

Source Code

TC++ #7591

Source Code

×

Ask AI About This Code

Default Prompt that is passed along with the code is given below, You can write your own prompt if you so desire.



×

Test CPP

Code Understanding

This program calculates the area and circumference of a circle when the radius is given by the user.
• #include allows input and output commands.
• const float PI = 3.14159; defines a constant value for π (pi).
• float, double, and long double are data types used for decimal numbers with different precisions.
• cin >> radius; takes the radius from the user.
• area = PI * radius * radius; uses the formula π × r² to find the area.
• circum = 2 * PI * radius; uses the formula 2 × π × r to find the circumference.
• cout statements display the results on the screen.
• return 0; ends the program.


Share

Created: 1-Mar-2026 15:55 | Updated: 1-Mar-2026 15:55|