- 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
Environmental Science
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
How to Find Area of Scalene Triangle using C
C Program to Find Area of Scalene Triangle :
#include <stdio.h>
#include <math.h>
int main() {
int s1, s2, angle;
float area;
printf("\nEnter Side1 : ");
scanf("%d", &s1);
printf("\nEnter Side2 : ");
scanf("%d", &s2);
printf("\nEnter included angle : ");
scanf("%d", &angle);
area = (s1 * s2 * sin((M_PI / 180) * angle)) / 2;
printf("\nArea of Scalene Triangle : %f", area);
return (0);
}
Output :
Enter Side1 : 3
Enter Side2 : 4
Enter included angle : 30
Area of Scalene Triangle : 3.000000
C Program for Beginners : Area of Scalene Triangle
Properties of Scalene Triangle :
• Scalene Triangle does not have sides having equal length.
• No angles of Scalene Triangle are equal.
• To calculate area we need at least two sides and the angle included by them.
Formula to Find Area of Scalene Triangle :
Explanation and Program Logic :
Part 1 : M_PI
sin((M_PI/180)*angle)
• It is Constant defined in math.h Header File
• It contain value = 3.14 in short instead of writing 3.14 write directly M_PI.
Part 2 : ( M_PI / 180 ) * angle
• We are accepting angle in degree.
• C function sin takes argument in radian , so to convert angle into radian we are purposefully writing above statement.
Part 3 : sin function
• It computes sine of an angle
- Related Questions & Answers
- How To Reduce the Array to 0 by decreasing elements by 1 or replacing at most K elements by 0
- Write C Program to Find Largest Element in Array in C Programming
- How To Clean Up Unnecessary Code From WordPress Header Without Plugins
- How to reads customer number and power consumed and prints amount to be paid using C
- How to check the type of triangle using C
- How to Calculate Area of Right angle Triangle using C Language
- Top 50 Programming Interview Questions & Answers (2021)
- Write C Program to Find Smallest Element in Array in C Programming
- How to find area and circumference of circle using C Programming
- How To Send mail from your Gmail account using Python
- Write C Program to Delete duplicate elements from an array
- Recursive program to linearly search an element in a given array using C
- How to read the values of x, y and z and print the results expressions in one line using C Program
- How to calculate gross salary of a person using C Program
- How to Calculate Area of Equilatral Triangle using C Language
- How to find sum of two numbers using C Language
Advertisements
ads