Find area of a circle in C, C++, Java and Python | faceprep

Find area of a circle in C, C++, Java and Python | faceprep

The program to find the area of a circle is discussed here. The area of the circle can be found using the formula, A = πr2 where r is the radius of the circle. When the radius of the circle is known, the area of the circle can be calculated using the formula mentioned.


finding_area_of_a_circle_in_c_c_java_and_python

INPUT & OUTPUT FORMAT:

  • The input corresponds to the radius of the circle.
  • The output corresponds to the area of the circle and it should be a floating point variable with 2-point precision.

Program to find the area of a circle using functions

@@coding::1@@


Program to find the area of a circle using pointers

@@coding::2@@


finding_area_of_a_circle_in_c_c_java_and_pythonClick here to learn more about FACE Prep PRO


Program to find the area of the circle using command line arguments

/*Here diameter is taken as the input*/n#include<stdio.h>n#define PI 3.14nint main(int a, char *b[])  //command line argumentsn{nint d; float area =0;nd= atoi(argv[1]);narea =(float) PI*(d/2)*(d/2);nprintf(“%0.2f”, area);  //%0.2f is to print the answer with 2 values after decimal point.nreturn 0;n}n



Recommended Programs








finding_area_of_a_circle_in_c_c_java_and_python