#include <stdio.h>
int main() {
int a, b,c;
scanf("%d%d%d", &a, &b,&c);
if ((a+b>c)&&(a+c>b)&&(b+c>a)){
printf("YES\n");
}else{
printf("NO\n");
}
return 0;
}
This code reads three integers and checks if they can form a triangle by verifying the triangle inequality theorem (sum of any two sides must be greater than the third). If all conditions are true, it prints "YES", otherwise "NO".
- There is a syntax error on the line where variables are declared. Look at the comma between `b` and `c` — it uses a different character (likely a full-width comma) instead of the standard ASCII comma. This will cause a compilation error.
- The `scanf` format string has no spaces between `%d`, which is fine, but ensure the commas in the variable list are all standard ASCII commas.