C program to enter radius of a circle and find its diameter, circumference and area.





/**

 *  To calculate diameter, circumference and area of circle

 */


#include <stdio.h>


int main()

{

    float radius, diameter, circumference, area;

    

    /*

     * Input radius of circle from user

     */

    printf("Enter radius of circle: ");

    scanf("%f", &radius);


    /*

     * Calculate diameter, circumference and area

     */

    diameter = 2 * radius;

    circumference = 2 * 3.14 * radius;

    area = 3.14 * (radius * radius);


    /*

     * Print all results

     */

    printf("Diameter of circle = %.1f units \n", diameter);

    printf("Circumference of circle = %.2f units \n", circumference);

    printf("Area of circle = %.1f sq. units ", area);


 

}

                                                 OUT PUT

                                       Enter radius of circle: 5

                                       Diameter of circle = 10.0 units

                                        Circumference of circle = 31.40 units

                                         Area of circle = 78.5 sq. units

                                           --------------------------------


------------------------
*****************************************

                                                   

 Related Question



 


➤Write a C program to enter length in centimeter and convert it into meter and kilometer

 ➤Write a C program to enter temperature in Celsius and convert it into Fahrenheit

➤Write a C program to enter temperature in Fahrenheit and convert to Celsius 

Write a C program to convert days into years, weeks and days.
*********************************************