Home
About US
Contact
Privacy Policy
Sitemap
Fehcn
Java Android Kotlin OOP
Toggle navigation
Android
C++
Java
Work
Other
Wednesday, 3 January 2018
How to find area of circle in C/C++ language
January 03, 2018
facebook
To find area of circle we must know about radius of circle.We will multiply square of radius with value of PI.PI is constant and its value is 3.14.
Area of circle = PI*radius*radius
C Code
#include
#include
#define PI 3.14 main() { float radius,area; printf("Enter radius of circle\n"); scanf("%f",&radius); area=PI*radius*radius; printf("Area of circle is %f",area); getch(); }
C++ Code
#include
#include
using namespace std; #define PI 3.14 main() { float radius,area; cout<<"Enter radius of circle\n"; cin>>radius; area=PI*radius*radius; cout<<"Area of circle is: "<
Working of Program:
When the above program is compiled and executed, it will ask for radius input.After user input performed value will be stored into radius variable.In the next line area of circle will be calculated and stored into area variable.And finally that calculated area will be displayed to the user.
Output:
C
,
C++
Popular Posts
Write a program to find area of triangle in C C++ language
Any shape that has 3 sides and three angles is called triangle. To find area of triangle we must know length of all three sides of a tria...
Write a program to find area of right angled triangle in C C++ language
A triangle is called right angled triangle if its one angle is 90 degree.There is no restriction on angle side or name.90 degree angle may b...
How to find area of circle in C/C++ language
To find area of circle we must know about radius of circle.We will multiply square of radius with value of PI.PI is constant and its val...
Operators in programming
Operators are symbols in java that are used to perform amazing operations on your data.Some of these symbols are &,^,* and ! .Java c...
Variables in programming
Variables are memory cells or memory locations that are used to store data during execution.Variable name remains same in complete execu...
Uses of computers in our daily life
Before starting the uses I would like to tell you What is computer. Not only our laptop and PC's are computers. Any device that can comp...
Report Abuse
Label
android
Arduino
Assignments
C
C++
Java
Linked List
Other
Semester 1
Counter