- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Program to find area of a Circular Segment in C++
In this tutorial, we will be discussing a program to find area of a circular segment.
Making a chord in a given sphere divides it into two segments - major and minor. Given the radius of the circle and angle making the minor segment, we are required to find the areas of both segments.
Example
#include <bits/stdc++.h> using namespace std; float pi = 3.14159; //finding area of segment float area_of_segment(float radius, float angle){ float area_of_sector = pi * (radius * radius)*(angle / 360); float area_of_triangle = (float)1 / 2 *(radius * radius) * sin((angle * pi) / 180); return area_of_sector - area_of_triangle; } int main() { float radius = 10.0, angle = 90.0; cout << "Area of minor segment = " << area_of_segment(radius, angle) << endl; cout << "Area of major segment = " << area_of_segment(radius, (360 - angle)); return 0; }
Output
Area of minor segment = 28.5397 Area of major segment = 285.619
- Related Articles
- C++ Program to find opponent in a circular standing of persons
- Program to find the Area of a Parallelogram in C++
- Program to find the Area of a Pentagon in C++
- C Program for Program to find the area of a circle?
- Area of a Circular Sector?
- Program to find the Area and Perimeter of a Semicircle in C++
- C++ Program to Find Largest Rectangular Area in a Histogram
- Program to find the Area of an Ellipse in C++
- Program to find area of a polygon in Python
- C++ program to find circumference of the circular pond with radius R
- Program to find the Area and Volume of Icosahedron in C++
- C++ program to find the Area of the Largest Triangle inscribed in a Hexagon?
- Program to find the Area of an Ellipse using C++
- C++ Program to Implement Circular Queue
- Program to find sum of non-adjacent elements in a circular list in python

Advertisements