Question:C program for area of a sphere 

Answer 
#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 

+ ExplanationNot Moderated
+ Report
Total Preview: 649
C program for area of a sphere
Copyright © 2024. Powered by Intellect Software Ltd