Welcome to collectivesolver - Programming & Software Q&A with code examples. A website with trusted programming answers. All programs are tested and work.

Contact: aviboots(AT)netvision.net.il

Prodentim Probiotics Specially Designed For The Health Of Your Teeth And Gums

Instant Grammar Checker - Correct all grammar errors and enhance your writing

Teach Your Child To Read

Powerful WordPress hosting for WordPress professionals

Disclosure: My content contains affiliate links.

31,104 questions

40,777 answers

573 users

How to calculate area, diameter and circumference of circle in C

1 Answer

0 votes
#include <stdio.h>
 
int main(void)
{
	int radius = 3;
	float PI = 3.14f;
 
	float area = PI * radius * radius;
	printf("Area = %.2f\n", area);
 
	float diameter = 2 * radius;
	printf("Diameter = %.2f\n", diameter);
 
	float circumference = 2 * PI * radius;
	printf("Circumference = %.2f\n", circumference);
     
    return 0;
}

 
/* 
run:

Area = 28.26
Diameter = 6.00
Circumference = 18.84

*/

 





answered Feb 18, 2016 by avibootz

Related questions

...