take a more accurate value of pi like 15+ digits and print line will be printf(“%.10f”,Area);
#include<stdio.h>
#define PI 3.141592653589793
int main()
{
int r;
double A;
scanf("%d",&r);
A=PI*r*r;
printf("%f10",A);
return 0;
}
PI = 3.1416
r = float(input())
print(PI * r * r)
getting wrong answer in test case 2 but why?
import math
r = input('enter a num:')
r = int(r)
area_num = float(math.pi * r**2)
print(area_num)
##this solution in python 3 .
Why i’m getting wrong in Test Case 2
#include <stdio.h>
int main()
{
float r,area,pi=3.1416;
r<2000;
scanf("%f",&r);
area=pi*(r*r);
printf("%f",area);
return 0;
}
Try using more accurate value of PI.
#include<stdio.h>
int main()
{
int a;
float pi,area;
pi=3.1415926536;
scanf("%d%lf",&a,&pi);
area=pi*a*a;
printf("%lf",area);
return 0 ;
}
Whats wrong?why it says wrong in test case 3?
The problem statement has been updated. It now includes the value of pi that you can use to solve this problem.
I also try it.But there is no problem!!
#include <iostream>
#include <iomanip>
#include <math.h>
using namespace std;
int main()
{
int a;
int b;
int c;
c=acos(-1);
b=-4;
cin>>a;
cout.setf(ios::fixed);
cout << setprecision(0) << a*b*c;
return 0;
}
can u help me out?
I am confused tbh … I am a beginner btw
import math
r=int(input(‘enter a num:’))
area_num=float(math.pi*(r**2))
print(area_num)
#what is the problem this code?
You have used:
r = int(input("enter a num:"))
Remove the enter a num parameter.
Use:
r = int(input())
And read the above discussions too. The same problem that you have faced has been responded to.
radius = float(input(“radius:”))
Pie = 3.1415926536
radius_square = radius**2
Area = Pie * radius_square
print(Area)
what’s wrong with this one?
ok, thank you.
i passed