Triangle

Well, I think you should not.

There was a debate when this problem appeared in the last preliminary and the external authors whom you are referring told that this is correct.

Just checking if a + b >= c && a + c >= b && b + c >= a is enough.

printf("\"Oh,No!\"\n");
        ^^  ^   ^^

And you should print “Oh, No!” without quotes. Also you forgot to put a space after the comma.

@touhidur Still have the problem… I know there are some syntax that are not necessary. But when I started getting WA again and again I added those.
Please check again

#include <stdio.h>
#include <math.h>
int main()
{
    int a, i;
    scanf("%d", &a);
    if(a<0)
    {
        printf("Oh,  No!\n");
    }
    for(i=1; i<=a; i++)
    {
        double a, b, c, s, area;
        scanf("%lf%lf%lf", &a, &b, &c);
        if(a+b>=c && a+c>=b && b+c>=a) {
        s=(a+b+c)/2;
        if(s>0)
        {
        printf("%0.2lf\n", sqrt(s*(s-a)*(s-b)*(s-c)));
        }
        else {
            printf("Oh, No!\n");
        }
        }
        else {
            printf("Oh, No!\n");
        }
    }
    return 0;
}
if (a < 0)
{
    printf("Oh, No!\n");
}

How can a be less than 0? You don’t need to check these kind of stuffs.

if (s > 0) {
    printf("%0.2lf\n", sqrt(s * (s - a) * (s - b) * (s - c)));
} else {
    printf("Oh, No!\n");
}

And you should read previous post carefully. Like I said before here, anything that raturns a positive real number in that equation is considered to be valid here. Even if s = 0. So, remove it also.

And please, if you want your code to reveiwed, please format it carefully just like you have before here. Otherwise, it is hard to read them. You should edit your post(s) now and format the codes properly. So that the people who read these posts after you from now on can be helped.

Okay, coding again. I will make the full code again

No need, just remove the stuff I told you too and submit it. It should work. And, do this also,

O Allah!
What’s wrong here???

#include <stdio.h>
#include <math.h>
int main()
{
    int a, i;
    scanf("%d", &a);
    for(i=1; i<=a; i++)
    {
        double a, b, c, s, area;
        scanf("%lf%lf%lf", &a, &b, &c);
        if(a+b>=c && a+c>=b && b+c>=a) {
        s=(a+b+c)/2;
        printf("%0.2lf\n", sqrt(s*(s-a)*(s-b)*(s-c)));
        }
        else {
            printf("Oh,No!\n");
        }
        }

    return 0;
}

I think I had told you to format your codes correctly if you want them to be reveiwed.
Please follow (or at least try to follow) previous instruction(s) before you do them yourself.

Finally, done.

1 Like

Please Help!

(Python 3.7)

import math
N=int(input())
A={}
no={}
for i in range(N):
a, b, c=input().split()
a=int(a)
b=int(b)
c=int(c)
if a+b<=c or a+c<=b or b+c<=a:
no[i]=1
else:
no[i]=0
s=(a+b+c)/2
s1=s-a
s2=s-b
s3=s-c
if no[i]==0:
A[i]=math.sqrt(ss1s2*s3)

for i in range(N):
if no[i]==1:
print(‘Oh, No!’)
if no[i]==0:
print(“%.2f” % A[i])

Wait, I removed the = from <= and they accepted it. Why?

< and <= works differently that’s why. And also I have described the reason quite a number in the previous so please read them carefully.
try to search for them to learn more.
And again please format your codes correctly before posting them in the community.
You can use this post as a reference.

1 Like
#include<stdio.h>
#include<math.h>
int main()
{
    int n;
    float area,a,b,c,s;
    scanf("%d",&n);
    for(n;n>0;n--){
        scanf("%f %f %f",&a,&b,&c);
        if((a+b > c) && (a+c > b) && (b+c >a) && a>0 && b>0 && c>0){
            s = (a+b+c)/2;
            area = sqrt(s * (s-a) * (s-b) * (s-c));
            printf("%.2f\n",area);
        }
        else{
            printf("Oh, No!");
        }
    }
}

vul kothay?wrong answer dekhacce kano jni

int i,n, a,b,c;
is flot…

ans:: flot i,n, a,b,c;

if(a+b >= c and b+c >= a and c+a >= b): then print(Area)
else: print(“Oh, No!”)
The condition is wrong but it is the right condition for this problem/contest