গোলকের আয়তন আকৃতির ক্ষমতা ছাড়া আর কিছুই নয়।
একটি গোলক সূত্রের আয়তন হল −
$$V\:=\:\frac{4}{3}\Pi\:r^{3}$$
অ্যালগরিদম
Step 1: Enter radius of sphere at runtime Step 2: Apply the formula to variable Volume=(4/3)*3.14*rad*rad*rad Step 3: print the volume Step 4: stop
প্রোগ্রাম 1
#include<stdio.h>
int main(){
float vol;
int rad;
rad=20;
vol=((4.0f/3.0f) * (3.1415) * rad * rad * rad);
printf("the volume of a sphere is %f\n",vol);
return 0;
} আউটপুট
the volume of a sphere is 33509.335938
প্রোগ্রাম 2
গোলকের আয়তন এবং সারফেস এরিয়া −
খুঁজে বের করার জন্য নিচে একটি উদাহরণ দেওয়া হল#include <stdio.h>
#include <math.h>
int main(){
float rad;
float area, vol;
printf("Enter radius of the sphere : \n");
scanf("%f", &rad);
area = 4 * (22/7) * rad * rad;
vol = (4.0/3) * (22/7) * rad * rad * rad;
printf("Surface area of sphere is: %.3f", area);
printf("\n Volume of sphere is : %.3f", vol);
return 0;
} আউটপুট
Enter radius of the sphere : 4 Surface area of sphere is: 192.000 Volume of sphere is : 256.000