- Back to Home »
- area , calculate , circle , code , coding , program , project , project c++(basic) »
- sample code to calculate area of a circle
Posted by : Unknown
Wednesday 24 December 2014
Allah Ditta wants a program that calculates and displays the area of a wheel given its radius. Use the constant value 3.14159 for π.
//area of wheel
#include<stdio.h>;
#include<conio.h>;
//executing main program
void main()
{
//creating vars to store data
int i;
float j = 3.14159;
//get radius from user
printf("Enter the radius of circle:");
scanf("%d", &i);
//displaying and calculating area
printf("The area of wheel is: %f", (i*i)*j);
//for disabling automatic close off of program after execution of program
_getch();
}//end main