Q:

C Program To Find Area and Circumference of Circle

belongs to collection: Basic C Programming Examples

0

you have to make this program in the following way:

  • C Program To Find Area and Circumference of Circle (Simple Way)
  • C Program To Find Area and Circumference of Circle Using Function
  • C Program To Find Area and Circumference of Circle Using Pointer

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

C Program To Find Area and Circumference of Circle

Algorithm

  • Program Start
  • Declare Variables
  • Input Radius From the User
  • Calculate Area of Circle
  • Calculate Circumference of circle
  • Print area of circle
  • Print circumference of circle
  • Program End

Program

#include<stdio.h>
void main()
{
float r,aoc, coc ;
printf("Enter the radius : ");
scanf("%f",&r);

aoc=3.14*(r*r);
coc = 2*3.14*r;

printf("Area of Circle is : %f",aoc);
printf("\nCircumference of Circle is : %f",coc);

}

Output

Enter the radius : 4
Area of Circle is : 50.240002
Circumference of Circle is : 25.120001

C Program To Find Area and Circumference of Circle Using Function

Algorithm

  • Program Start
  • Declare Variables
  • Input Radius From the User
  • Calling Function to find area of circle
  • Calculate Area of Circle
  • Print Area of circle
  • Calling Function to find circumference of circle
  • Calculate Circumference of circle
  • Print circumference of circle
  • Program End

Program

#include<stdio.h>
void aoc(float r)
{
    float area;

    area = 3.14*(r*r);
    printf("Area of Circle is : %f",area);
}
void coc(float r)
{
    float area;

    area =2*3.14*r;

    printf("\nCircumference of Circle is : %f",area);
}
void main()
{
float r;
printf("Enter the radius : ");
scanf("%f",&r);

aoc(r);
coc(r);

}

Output

Enter the radius : 6
Area of Circle is : 113.040001
Circumference of Circle is : 37.680000

C Program To Find Area and Circumference of Circle Using Pointer

Program

#include<stdio.h>
void aoc(float *r)
{
    float area;

   //here r is a pointer variable 
    area = 3.14*(*r)*(*r);
    printf("Area of Circle is : %f",area);
}
void coc(float *r)
{
    float area;
  //here r is a pointer variable
    area =2*3.14*(*r);

    printf("\nCircumference of Circle is : %f",area);
}
void main()
{
float r;
printf("Enter the radius : ");
scanf("%f",&r);

aoc(&r);
coc(&r);

}

Output

Enter the radius : 3
Area of Circle is : 28.260000
Circumference of Circle is : 18.840000

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Basic C Programming Examples

This question belongs to these collections

Similar questions


need a help?


find thousands of online teachers now
Leap Year Program In C (5 Different Ways)... >>
<< C Program To Find Area and Perimeter of Triangle...