Circles in a Rectangle

Two circles are placed inside a rectangle. They do not intersect with each other but they are touchi…

Click here to read the complete problem statement.


If you need help solving this problem, mention your approach and ask specific questions. Please avoid sharing your code and asking the Community to figure out “what’s wrong”.

#include <stdio.h>

int main() {
int T,x,i;
float r,pi=3.1416,A;
scanf(“%d”,&T);
for(i=0;i<T;i++){
scanf(“%f”,&r);
A=4-pi;
x=i+1;
A=A2r*r;
printf(“Case %d: %.2f\n”,x,A);

}

return 0;

}

what’s wrong with this code?
this is telling that case 3: 12638.46 but in my code it’s telling 12638.47.why?

//um passing time with the chili sauce
#include<bits/stdc++.h>
using namespace std;
#define io_fast() ios :: sync_with_stdio(false); cin.tie(0);
#define go return 0
#define ll long long int
#define ull unsigned long long int
#define ld long double
#define vi vector
#define vl vector
#define vc vector
#define vs vector
#define vp vector< pair<ll,ll> >
#define sl set
#define sc set
#define pi 2*acos(0.0)

int main()
{
io_fast();
float t,r,m,p;
int d=1;
cin>>t;
while(t–){
cin>>r;
m=2rr*(4.0-pi);
printf(“Case %d: %.2f\n”,d++,m);
}
go;
}
whats the pb?it cannt pass the testcase

@dipto98 Bro, can you provide the 4th test case? My code is failing at 4th tc.

u have to find out the area of the rectangle and area of two circle…then simply substraction of them

is there a figure provided ? cause i’m not seeing any green area there…strong text

I can’t even see any figure

download

#include <stdio.h>

int main(void)
{
    float pi = 3.1416;
    int n;
    scanf("%d", &n);
    float ar[n];
    for (int i = 0; i < n; i++)
    {
        scanf("%f", &ar[i]);
    }

    float result[n];
    for (int i = 0; i < n; i++)
    {
        float a = ar[i] * 2;
        float b = a * 2;
        float rectangleArea = a * b;
        float circlesArea = 2 * (pi * (ar[i] * ar[i]));
        float area = rectangleArea - circlesArea;
        result[i] = area;
    }
    for (int i = 0; i < n; i++)
    {
        printf("%0.2f\n", result[i]);
    }

    return 0;
}

what’s wrong with this code?