এই নিবন্ধে, আমরা বুঝব কিভাবে একটি বৃত্তের ক্ষেত্রফল বের করা যায়। একটি বৃত্তের ক্ষেত্রফল −
সূত্র ব্যবহার করে গণনা করা হয়pie*radius*radius. i.e. πr2 Where π = 3.14 and r is the radius of the circle.
নীচে একই -
এর একটি প্রদর্শন রয়েছে৷ইনপুট
ধরুন আমাদের ইনপুট হল −
Radius of the circle : 5
আউটপুট
কাঙ্খিত আউটপুট হবে −
The Area of Circle is: 78.57142857142857
অ্যালগরিদম
Step 1 – START Step 2 – Declare 2 double variables area and radius Step 3 – Read the value of the radius from the user Step 4- Calculate the area of the circle by using the formula (22*radius*radius)/7 and store the result as area Step 5- Display the area value Step 6 – STOP
উদাহরণ 1
এখানে, একটি প্রম্পটের উপর ভিত্তি করে ব্যবহারকারী দ্বারা ইনপুট প্রবেশ করানো হচ্ছে। আপনি আমাদের কোডিং গ্রাউন্ড টুলে এই উদাহরণ লাইভ চেষ্টা করতে পারেন
।
import java.util.Scanner;
public class AreaOfCircle{
public static void main(String args[]){
double area, radius;
System.out.println("Required packages have been imported");
Scanner my_scanner= new Scanner(System.in);
System.out.println("A Scanner object has been defined ");
System.out.println("Enter the radius of the circle:");
radius= my_scanner.nextDouble();
area=(22*radius*radius)/7 ;
System.out.println("The Area of Circle is: " + area);
}
} আউটপুট
Required packages have been imported A Scanner object has been defined Enter the radius of the circle: 5 The Area of Circle is: 78.57142857142857
উদাহরণ 2
এখানে, পূর্ণসংখ্যা পূর্বে সংজ্ঞায়িত করা হয়েছে, এবং এর মান অ্যাক্সেস করা হয়েছে এবং কনসোলে প্রদর্শিত হয়েছে।
public class AreaOfCircle{
public static void main(String args[]){
double area, radius;
radius= 5;
System.out.printf("The radius of the circle is %.8f ", radius);
area=(22*radius*radius)/7 ;
System.out.println("\nThe Area of Circle is: " + area);
}
} আউটপুট
The radius of the circle is 5.00000000 The Area of Circle is: 78.57142857142857