a) Make a program to find the diameter d=2r and area=4Πr2 or 4 pie r square of the sphere. Value of ‘r’ should be defined by the user.
#include <stdio.h>
#include <math.h>
int main()
{
float r;
float d;
float S;
printf("Please, enter the radius of the sphere: ");scanf("%f", &r);
d=2*r;
S=4*3.14*pow(r,2);
printf("\nDiameter Of the sphere is: %g", d);
printf("\nArea Of the sphere is: %g", S);
}
Comments
Leave a comment