Skip to main content

Posts

Showing posts with the label Macro

Find Area and Circumference of a Circle

#include<stdio.h> #define PI 3.142 void main() { float r,a,c; printf("\nEnter the radius of circle:\t"); scanf("%f",&r); a=PI*r*r; printf("\nThe area of the circle:\t%f",a); c=2*PI*r; printf("\nThe circumference of the circle: %f",c); } Output   Print   Download Code Output Enter the radius of circle: 2 The area of the circle: 12.568000 The circumference of the circle: 12.568000 Enter the radius of circle: 1 The area of the circle: 3.142000 The circumference of the circle: 6.284000