Answer to Question #159033 in C for Arslan habib

Question #159033

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>


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);
    
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS