19. Program that computes the area of a sector of a circle when theta is the angle in radians between the radii.

Chapter 4: 

Input And Output

Programming Exercise

Problem # 19:

Write a program that computes the area of a sector of a circle when theta is the angle in radians between the radii.

Solution:

#include<iostream>
#include<conio.h>
using namespace std;
int main()
{
// ((r*r)/2)*theta
float theta, radius, area;
cout<<"Enter radius of circle : ";
cin>>radius;
cout<<"Enter angle in radians between radii : ";
cin>>theta;
area = (theta/2)*radius*radius;
cout<<"Area of a sector of a circle : "<<area<<endl;
return 0;
}

Let me know in the comment section if you have any question.

Previous Post:
Program that inputs pounds from the user and converts it into kilograms.

Comments

Post a Comment