Formula of surface area of sphere:
Surface_area = 4 * Pie * r2
Formula of volume of sphere:
Volume = 4/3 * Pie * r3
Pie = 22/7 or 3.14159265358979323846264338327950288419716939937510...
C code:
#include<stdio.h>
#include<math.h>
int main(){
float r;
float surface_area,volume;
printf("Enter radius of the sphere : ");
scanf("%f",&r);
surface_area = 4* M_PI * r * r;
volume = (4.0/3) * M_PI * r * r * r;
printf("Surface area of sphere is: %.3f",surface_area);
printf("\nVolume of sphere is : %.3f",volume);
return 0;
}
Sample output:
Enter radius of the sphere: 5
Surface area of sphere is: 314.159
Volume of sphere is: 523.599
7. Write a c program to find the area of rhombus.
8. Write a c program to find the area of parallelogram.
No comments:
Post a Comment