#Problem-1 Week 1

Category: Coding Challanges & Approved by adwivedi008@gmail.com On May-17-2021 19:29:28

Write a C program to find the area of a circle with radius provided.
The value of radius positive integer passed to the program as the first
command line parameter. Write the output to stdout formatted as a floating
point number rounded to EXACTLY 2 decimal precision WITHOUT any other
additional text.
Scientific format(such as 1.00E+5) should NOT be used while printing the
output.
You may assume that the inputs will be such that the output will not exceed
the largest possible real number that can be stored in a float type variable.


Note You can submit your code in C_C++_Python_Java_JS_Php


Comments

Ujjwal Kumar

May-17-2021 19:28:16

#include #include #include void main() { float r,a; float pi=3.14; scanf("%f",&r); a=pi*r*r; printf("Area of circle is %.2f\n",round(a)); }


Vamshik n.p

May-17-2021 20:27:57

r=int(input("enter the number:")) value=(3.142*r*r) print("Area is",value) print("the round of area to two digits",(round(value,3)))


ayushi gangele

May-19-2021 11:09:01

#include int main() { int dia; float r, area; scanf("%d",&dia); r = (float)dia/2; area = 3.14*r*r; printf("%0.2f",area); return 0; }


Share your thoughts about this post
web counter