URI Online Judge Solution 1040 Average 3 – Solution in C, C++, Java, Python and C#

URI Online Judge Solution URI Solution -Beginner

URI Online Judge Solution 1040 Average 3 – Solution in C, C++, Java, Python and C#

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

Problem Name: 1040 Average 3 solution
Problem Number : URI – 1040 Average 3 code
Online Judge : URI Online Judge Solution
Category: Beginner
Solution Language : C,C plus plus, java, python, c#(c sharp)

URI 1040 Average 3 Code in C / URI 1040 Average 3  solution in C:

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

double
a, b, c, d, last, m;
scanf("%lf %lf %lf %lf", &a, &b, &c, &d);
m = (a * 2 + b * 3 + c * 4 + d) / 10;
printf("Media: %.1fn", m);
if
(m >= 7.0){
printf("Aluno aprovado.n");
}

else if
(m >= 5.0)
{

printf("Aluno em exame.n");
scanf("%lf", &last);
printf("Nota do exame: %.1fn", last);
if
(last + m / 2.0 > 5.0){
printf("Aluno aprovado.n");
}

else
{
printf("Aluno reprovado.n");
}

printf("Media final: %.1fn", (last + m ) / 2.0);
}

else
{
printf("Aluno reprovado.n");
}

return
0;
}

URI 1040 Average 3 Code in C++ / URI 1040 Average 3 solution in CPP:

#include <cstdio>

#define SC1(a) scanf("%f", &a)
#define SC4(a, b, c, d) scanf("%f %f %f %f", &a, &b, &c, &d)

using namespace
std;

int
main(int argc, char const *argv[])
{

float
a, b, c, d, m, f;

SC4(a, b, c, d);
a = (a * 20)/100;
b = (b * 30)/100;
c = (c * 40)/100;
d = (d * 10)/100;
m = a + b + c + d;

if
(m >= 7.0){
printf("Media: %.1fnAluno aprovado.n", m);
}
else if(m < 5.0){
printf("Media: %.1fnAluno reprovado.n", m);
}
else{
SC1(f);
printf("Media: %.1fnAluno em exame.nNota do exame: %.1fn", m, f);
if
((m + f) / 2 < 5.0) printf("Aluno reprovado.nMedia final: %.1fn", (m + f) / 2);
else
printf("Aluno aprovado.nMedia final: %.1fn", (m + f) / 2);
}


return
0;
}

URI 1040 Average 3 Code in java/ URI 1002 solution in Java:

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

public class
Main {

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


float
N1, N2, N3, N4,average,N5,recalaverage;
Scanner input =new Scanner(System.in);
N1 =input.nextFloat();
N2 =input.nextFloat();
N3 =input.nextFloat();
N4 =input.nextFloat();

average =((N1 * 2)+(N2 * 3)+( N3 * 4)+(N4 * 1))/10;

if
(average >= 7.0) {

System.out.printf("Media: %.1fn",average);
System.out.print("Aluno aprovado.n");

}


else if
(average >= 5.0 && average <= 6.9) {

System.out.printf("Media: %.1fn",average);
System.out.print("Aluno em exame.n");
N5 =input.nextFloat();
System.out.printf("Nota do exame: %.1fn",N5);
recalaverage =(average + N5) / 2;

if
(recalaverage >= 5.0) {
System.out.print("Aluno aprovado.n");

}
else {
System.out.print("Aluno reprovado.n");

}


System.out.printf("Media final: %.1fn",recalaverage);

}


else if
(average < 5.0) {

System.out.printf("Media: %.1fn",average);
System.out.print("Aluno reprovado.n");

}

}

}

URI 1040 Average 3 Code in Python / URI 1040 Average 3 solution in Python:

URI Solution 1040 Average 3 Code / URI 1040 Average 3 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 Average 3 code in C, URI 1040 Average 3 code in C++, URI Average 3  solution in C, URI solution, URI 1040 solution in C,URI 1040 Average 3  solution in C++-CPP,URI 1040 solution in C# (C sharp),URI 1040 solution in Java,URI 1040 Average 3 solution in Python,

Leave a Reply

Your email address will not be published.