luc061.c¶
Problem Statement
The area of a triangle can be computed by the sine law. Given 6 triangular pieces of land (a, b, angle), find their area and determine which is largest.
Metadata¶
| Property | Detail |
|---|---|
| Author | Amit Dutta amitdutta4255@gmail.com |
| Date | 08 Feb 2026 |
| License | MIT License (See the LICENSE file for details) |
Actions¶
💡 You can print or save this file by opening Raw and using your browser.
Source Code¶
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
int main()
{
// Data arrays
double a[] = {137.4, 155.2, 149.3, 160.0, 155.6, 149.7};
double b[] = {80.9, 92.62, 97.93, 100.25, 68.95, 120.0};
double angle[] = {0.78, 0.89, 1.35, 9.00, 1.25, 1.75}; // Assuming radians based on values < 2.0. 9.00 is treated as literal.
double area, max_area = 0.0;
int i, max_index = -1;
printf("Plot No.\tArea\n");
printf("------------------------\n");
for (i = 0; i < 6; i++)
{
// Area = 1/2 * a * b * sin(angle)
area = 0.5 * a[i] * b[i] * sin(angle[i]);
printf("%d\t\t%.2f\n", i + 1, area);
if (area > max_area)
{
max_area = area;
max_index = i + 1;
}
}
printf("\nLargest Plot is No. %d with Area: %.2f\n", max_index, max_area);
return 0;
}