ให้ r1, r2, r3 งานคือหาปริมาตร Ellipsoid Ellipsoid คือ quadric surface ผิวที่สามารถกำหนดได้จากพหุนามดีกรี 2 ใน 3 ตัวแปร ระหว่าง quadric surfaces ellipsoid มีลักษณะเฉพาะสองอย่าง
สูตรคำนวณปริมาตร Ellipsoid
Volume of Ellipsoid : (4/3) * pi * r1 * r2 * r3
ตัวอย่าง
Input-: r1 = 6.3, r2 = 43.4, r3 = 3.7 Output-: volume of ellipsoid is : 4224.87
อัลกอริทึม
Start Step 1 -> define macro as #define pi 3.14 Step 2 -> Declare function to calculate Volume of ellipsoid float volume(float r1, float r2, float r3) return 1.33 * pi * r1 * r2 * r3 Step 3 -> In main() Declare variable as float r1 = 6.3, r2 = 43.4, r3 = 3.7 Volume(r1, r2, r3) Stop
ตัวอย่าง
#include <bits/stdc++.h> #define pi 3.14 using namespace std; // Function to find the volume of ellipsoid float volume(float r1, float r2, float r3){ return 1.33 * pi * r1 * r2 * r3; } int main(){ float r1 = 6.3, r2 = 43.4, r3 = 3.7; cout << "volume of ellipsoid is : " << volume(r1, r2, r3); return 0; }ผลลัพธ์
volume of ellipsoid is : 4224.87