Friday, September 2, 2016

// // Leave a Comment

C Program To Calculate Diameter, Circumference and Area of a Circle

Question: Write a program that reads in the radius of a circle and prints the circle’s diameter, circumference and area. Use the constant value 3.14159 for π. Perform each of these calculations inside the printf statement(s) and use the conversion specifier %f.
 * Website: 
 * Program to calculate the diameter, circumference and area of a circle.

#include <stdio.h>
int main ( ){
    int rad;
    puts("Enter radius of circle: ");
    scanf("%d", &rad);
    printf("Diameter is %d\n", 2 * rad);
    printf("Circumference is %f\n", 2 * 3.14159 * rad);
    printf("Area is %f\n", 3.14159 * rad * rad);
    return 0;
Diameter, circumference, area of a  circle c program calculator
Program Output
Click here to see other solutions to Deitel C How To Program exercises.


Post a Comment

DISCLAIMER: Opinions expressed in comments are those of the comment writers alone and does not reflect or represent the views of the post author. We reserve the right to delete any post deemed inappropriate or offensive and/or spammy. Please do not use abusive words/hate speech.

I Appreciate your valuable Feedback. So, Please DO NOT SPAM - Spam comments will be deleted immediately.

Don't use brand name in name field and you're not allowed to use links in comments unless it's necessary. Such comments will be removed immediately. To get notified of replies or follow-up comments, click the box next to notify me.