C program to calculate Area , circumference and Diameter of Circle using Macro.

#include<stdio.h>
#define AREA(r) (3.14*r*r)
#define CIRCUM(r) (2*3.14*r)
#define DIAMETER(r) (2*r)
int main()
{
    float r,A,C,D;
    printf("\n Enter a value of r:");
    scanf("%fcm",&r);
    A=AREA(r);
    C=CIRCUM(r);
    D=DIAMETER(r);
    printf("\n The area=%.2fcm²",A);
    printf("\n The circumference=%.2fcm",C);
    printf("\n The diameter=%.2fcm",D);
    return 0;
}


***Input && Output***



Post a Comment

0 Comments