Thursday, 16 November 2017

C Program to Find Volume and Surface Area of Sphere


Code:

#include   stdio.h
#include   math.h

int main()
{

    float radius;
    float surface_area, volume;

    printf("Enter radius of the sphere : \n");
    scanf("%f", &radius);
    surface_area =  4 * (22/7) * radius * radius;
    volume = (4.0/3) * (22/7) * radius * radius * radius;
    printf("Surface area of sphere is: %.3f", surface_area);
    printf("\n Volume of sphere is : %.3f", volume);
    return 0;
}


Output:

Enter radius of the sphere :
40
Surface area of sphere is: 19200.000
Volume of sphere is : 256000.000


More C Programs:












100+ Best Home Decoration Ideas For Christmas Day 2019 To Make Home Beautiful

Best gifts for Christmas Day | Greeting cards for Christmas Day | Gift your children a new gift on Christmas day This Christmas d...