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.
1
Expert's answer
2021-01-29T04:16:29-0500
#include<stdio.h>#include<math.h>intmain(){
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