ট্রাপিজিয়াম হলো এমন একটি চতুর্ভুজ যেটির কমপক্ষে এক জোড়া বাহু সমান্তরাল। এর ক্ষেত্রফল ও পরিসীমার সূত্র:
- পরিসীমা = সব বাহুর যোগফল
- ক্ষেত্রফল = ½ × (সমান্তরাল বাহু দুটির যোগফল) × লম্ব দূরত্ব
কোড লজিক: ৫টি বাহু এবং লম্ব দূরত্ব নেওয়া হয়েছে। ক্ষেত্রফলের জন্য ফ্লোট ভেরিয়েবল ব্যবহার করা হয়েছে। সূত্র: 0.5 × (a + b) × h। পরিসীমার জন্য সব বাহুর যোগফল।
উদাহরণ
#include <stdio.h>
int main() {
int a = 2, b = 3, c = 5, d = 4, h = 5;
float area, perimeter;
printf("The sides of trapezium are %d , %d , %d , %d \n", a, b, c, d);
printf("Distance between two parallel sides is %d \n", h);
perimeter = a + b + c + d;
area = 0.5 * (a + b) * h;
printf("Perimeter of the trapezium is %.1f\n", perimeter);
printf("Area of the trapezium is: %.3f", area);
return 0;
}
আউটপুট
The sides of trapezium are 2 , 3 , 5 , 4 Distance between two parallel sides is 5 Perimeter of the trapezium is 14.0 Area of the trapezium is: 12.500