URI Online Judge Solution 1043 Triangle Solution in C, C++, Java, Python and C#

URI Online Judge Solution URI Solution -Beginner

URI Online Judge Solution 1043 Triangle Solution in C, C++, Java, Python and C#

URI Online Judge Solution 1043 Triangle | Beginner
URI Problem Link – https://www.urionlinejudge.com.br/judge/en/problems/view/1043

Problem Name: 1043 Triangle Solution
Problem Number : URI – 1043 Triangle Code
Online Judge : URI Online Judge Solution
Category: Beginner
Solution Language : C,C plus plus, java, python, c#(c sharp)

URI Online Judge Solution 1043 Triangle Solution in C, C++, Java, Python and C#

URI 1043 Triangle Code in C / URI 1043 solution in C:

#include<stdio.h>
int main()
{

float
A, B, C, areaTraphisium, perimeterTriangle ;

scanf("%f %f %f", &A, &B, &C);

if
((A < (float)(B+C)) && (B < (float)(A+C)) && (C < (float)(B+A)))
{

perimeterTriangle = A + B + C;
printf("Perimetro = %.1fn",perimeterTriangle);


}

else

{

areaTraphisium = ((A + B) * C) / 2;
printf("Area = %.1fn",areaTraphisium);
}

return
0;
}


URI 1043 Triangle Code in C++ / URI 1043 solution in CPP:

#include <iostream>
#include <iomanip>

using namespace
std;

int
main()
{

float
a, b, c;
bool
ver = false;

cin >> a >> b >> c;

float
mod = b - c;
if
(mod < 0)
mod = -mod;

if
(mod < a && a < (b + c)){
cout << "Perimetro = " << fixed << setprecision(1) << (a + b + c) << endl;
}
else{
cout << "Area = " << fixed << setprecision(1) << ((a + b) * c) / 2 << endl;
}


return
0;
}

URI 1043 Triangle Code in java/ URI 1043 solution in Java:

import java.io.IOException;
import java.util.Scanner;

public class
Main {

public static
void main(String[] args) throws IOException {

float
A, B, C, areaTraphisium, perimeterTriangle ;

Scanner input =new Scanner(System.in);
A = input.nextFloat();
B = input.nextFloat();
C = input.nextFloat();

if
((A < (float)(B+C)) && (B < (float)(A+C)) && (C < (float)(B+A))) {
perimeterTriangle = A + B + C;
System.out.printf("Perimetro = %.1fn",perimeterTriangle);


}
else {
areaTraphisium = ((A + B) * C) / 2;
System.out.printf("Area = %.1fn",areaTraphisium);
}
}

}

URI 1043 Triangle Code in Python / URI 1043 solution in Python:

URI Solution 1043 Triangle Code / URI 1043 solution in  C# (C Sharp):

Demonstration:

Just implement this in coding. Since having any problem just put a comment below. Thanks

Tags: URI Online Judge Solution, URI OJ Solution list, URI Problems Solution, URI solver, URI all problem solution list, URI 1043 Triangle  code in C, URI 1043 Triangle code in C++, URI 1043 Triangle  solution in C, URI solution, URI 1043 solution in C,URI 1043 solution in C++-CPP,URI 1043 Triangle solution in C# (C sharp),URI 1043 solution in Java,URI 1043 solution in Python,

Leave a Reply

Your email address will not be published.