URI Online Judge Solution 1012 Area - URI 1012 Solution in C, C++, Java, Python and C#
URI Online Judge Solution 1012 Area | BeginnerURI Problem Link - https://www.urionlinejudge.com.br/judge/en/problems/view/1012
Problem Name: 1012 Area code
Problem Number : URI - 1012 Area solution
Online Judge : URI Online Judge Solution
Category: Beginner
Solution Language : C,C plus plus, java, python, c#(c sharp)
URI Solution 1012 Area Code in C/ URI 1012 solution in C:
URI 1012 in simple way:
#include <stdio.h> int main() { double a, b, c; scanf("%lf %lf %lf", &a, &b, &c);
printf("TRIANGULO: %.3lf\n", (a * c) / 2); printf("CIRCULO: %.3lf\n", c * c * 3.14159); printf("TRAPEZIO: %.3lf\n", ((a + b) / 2) * c); printf("QUADRADO: %.3lf\n", b * b); printf("RETANGULO: %.3lf\n", a * b); return 0; }
URI 1012 in advanced way (Using while loop):
#include <stdio.h> #define pi 3.14159 int main () { float a,b,c; while (scanf("%f %f %f",&a,&b,&c) != EOF) { printf ("TRIANGULO: %.3f\n",.5*(a*c)); printf ("CIRCULO: %.3f\n",pi*(c*c)); printf ("TRAPEZIO: %.3f\n",.5*(a+b)*c); printf ("QUADRADO: %.3f\n",b*b); printf ("RETANGULO: %.3f\n",a*b); } return 0; }
URI Solution 1012 Area Code / URI 1012 Area solution in CPP:
#include <cstdio> int main() { double a, b, c; scanf("%lf", &a); scanf("%lf", &b); scanf("%lf", &c); printf("TRIANGULO: %.3lf\n", (a * c) / 2); printf("CIRCULO: %.3lf\n", c * c * 3.14159); printf("TRAPEZIO: %.3lf\n", ((a + b) / 2) * c); printf("QUADRADO: %.3lf\n", b * b); printf("RETANGULO: %.3lf\n", a * b); return 0; }
URI Solution 1012 Area Code / URI 1012 Area solution in Java:
import java.util.Scanner; public class Main { public static void main(String[] args) { double a, b, c; Scanner sc = new Scanner(System.in); a = sc.nextDouble(); b = sc.nextDouble(); c = sc.nextDouble(); System.out.printf("TRIANGULO: %.3f\n", (a * c) / 2); System.out.printf("CIRCULO: %.3f\n", c * c * 3.14159); System.out.printf("TRAPEZIO: %.3f\n", ((a + b) / 2) * c); System.out.printf("QUADRADO: %.3f\n", b * b); System.out.printf("RETANGULO: %.3f\n", a * b); } }
URI Solution 1012 Area Code / URI 1012 Area solution in Python:
valor = input().split(" ") a, b, c = valor pi = 3.14159 triangulo = (float(a) * float(c))/2 circulo = pi * (float(c)* float(c)) trapezio = float(c) *(float(a) + float(b)) / 2 quadrado = float(b) * float(b) retangulo = float(a) * float(b) print("TRIANGULO: %0.3f\nCIRCULO: %0.3f\nTRAPEZIO: %0.3f\nQUADRADO: %0.3f\nRETANGULO: %0.3f" % (triangulo, circulo, trapezio, quadrado, retangulo))
URI Solution 1012 Area Code / URI 1012 Area solution in C# (C Sharp):
Demonstration:
By the rules of all of the rectangles, just do this..
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 area code in C, URI 1012 Area code in C++, URI Area solution in C, URI solution, URI 1012 Area solution in C,URI 1012 Area solution in C++-CPP,URI 1012 Area solution in C# (C sharp),URI 1012 Area solution in Java,URI 1012 Area solution in Python,
I believe I did this program correctly, my math matched up with both the desired output and the solution (Java), but I keep receiving 'Wrong Answer' and I have no idea why.
ReplyDelete#python
ReplyDeletei take input as..
A = float(input())
B = float(input())
C = float(input())
the program ran successfully but in submission i got "Runtime Error"
when I used...
valor = input().split(" ")
a, b, c = valor
this procedure the program did not worked...
what can i do?
This input taking procedure works wonderfully without a run-time error.
ReplyDeletearr = input().split(" ")
A = float(arr[0])
B = float(arr[1])
C = float(arr[2])
#include
ReplyDeleteint main()
{
double A,B,C;
scanf("%lf %lf %lf",&A, &B, &C);
double TRIANGULO = 0.5*A*C;
double CIRCULO = 3.14159 * C * C;
double TRAPEZIO = (A+B)/2*C;
double QUADRADO = (B*B);
double RETANGULO = (A*B);
printf("TRIANGULO: %.3lf\n",TRIANGULO);
printf("CIRCULO: %.3lf\n",CIRCULO);
printf("TRAPEZIO: %.3lf\n",TRAPEZIO);
printf("QUADRADO: %.3lf\n",QUADRADO);
printf("RETANGULO: %.3f\n",RETANGULO);
return 0;
}
in c i solve it
#include
ReplyDelete#include
using namespace std;
int main()
{
float A, B, C, tri,cir, trap, quad, rect, pi = 3.14159;
cin>>A>>B>>C;
cout<<fixed<<setprecision(3)<<"TRIANGULO: "<< (A*C)/2 << endl;
cout<<fixed<<setprecision(3)<<"CIRCULO: "<< pi*C*C << endl;
cout<<fixed<<setprecision(3)<<"TRAPEZIO: "<< ((A+B)/2)*C << endl;
cout<<fixed<<setprecision(3)<<"QUADRADO: "<< B*B << endl;
cout<<fixed<<setprecision(3)<<"RETANGULO: "<< A*B << endl;
return 0;
}
what is the wrong here can anybody tell me??????? its so annoying