Friday, March 28, 2014

Get radius from user and calculate the diameter, area and circumference of the Circle

#include<stdio.h>
#include<stdlib.h>
void line()
{
int i,j;
printf("\n");
for(i=1;i<=42;i++)
printf("=");
}
void header()
{
printf("\n");
printf("Built and Designed by Arslan Malik\n\n www.CworldbyAS.blogspot.com");
printf("\n");
}
int main()
{
line();
header();
line();

int radius,diameter;
float circumference,area;
printf("\n Enter Radius :   ",radius);
scanf("%d",&radius);
diameter=2*radius;
printf("\nDiameter is : %d\n",diameter);
area=2*3.14159*radius*radius;
printf("Area is : %f\n",area);
circumference=2*3.14159*radius;
printf("Circumference is : %f\n\n",circumference);
return 0;
}

No comments:

Post a Comment