কম্পিউটার টিউটোরিয়াল

C প্রোগ্রাম: বৃত্তের ক্ষেত্রফল বের করা


ক্ষেত্রফল হলো দ্বিমাত্রিক সমতলে একটি আকৃতি কত জায়গা ঘেরেছে তার পরিমাপ। বৃত্তের ক্ষেত্রফল বের করতে ত্রিজ্যা (r) বা ব্যাস (d = 2r) দরকার।

সূত্র: πr² বা (πd²)/4

উদাহরণ কোড (ত্রিজ্যা দিয়ে)

#include <stdio.h>
int main(void) {
    float pie = 3.14;
    int radius = 6;
    printf("The radius of the circle is %d \n", radius);
    float area = (float)(pie * radius * radius);
    printf("The area of the given circle is %f", area);
    return 0;
}

আউটপুট

The radius of the circle is 6
The area of the given circle is 113.040001

উদাহরণ কোড (math.h-এর pow() ব্যবহার করে)

#include <stdio.h>
#include <math.h>
int main(void) {
    float pie = 3.14;
    int radius = 6;
    printf("The radius of the circle is %d \n", radius);
    float area = (float)(pie * pow(radius, 2));
    printf("The area of the given circle is %f", area);
    return 0;
}

আউটপুট

The radius of the circle is 6
The area of the given circle is 113.040001

উদাহরণ কোড (ব্যাস দিয়ে)

#include <stdio.h>
int main(void) {
    float pie = 3.14;
    int diameter = 12;
    printf("The Diameter of the circle is %d \n", diameter);
    float area = (float)((pie * diameter * diameter) / 4);
    printf("The area of the given circle is %f", area);
    return 0;
}

আউটপুট

The Diameter of the circle is 12
The area of the given circle is 113.040001

  1. C++ ব্যবহার করে এলিপসের এরিয়া বের করা

  2. জাভা প্রোগ্রাম: সমান্তরাল চতুর্ভুজের ক্ষেত্রফল বের করার পদ্ধতি

  3. জাভা প্রোগ্রাম: বৃত্তের পরিধি (Perimeter) বের করার পদ্ধতি

  4. জাভা প্রোগ্রাম: ট্রাপিজিয়াম (Trapezium) এর ক্ষেত্রফল বের করার পদ্ধতি