URI Online Judge | 1079 Weighted Averages - Solution in C, C++, Java, Python and C# - Online Judge Solution

Latest

It is a free Online judges problems solution list. Here you can find UVA online Judge Solution, URI Online Judge Solution, Code Marshal Online Judge Solution, Spoz Online Judge Problems Solution

Friday, November 24, 2017

URI Online Judge | 1079 Weighted Averages - Solution in C, C++, Java, Python and C#

URI Online Judge | 1079 Weighted Averages - Solution in C, C++, Java, Python and C#

URI Online Judge Solution 1079 Weighted Averages  | Beginner
URI Problem Link - https://www.urionlinejudge.com.br/judge/en/problems/view/1079

Problem Name: 1079 Weighted Averages
Problem Number : URI - 1079 Weighted Averages
Online Judge : URI Online Judge Solution
Category: Beginner
Solution Language : C,C plus plus, java, python, c#(c sharp)



URI Solution 1079 Weighted Averages Code in C:


#include <stdio.h>

int main()
{
 int n;
 double a;
 double b;
 double c;

 scanf("%i", &n);

 for (int i = 0; i < n; ++i)
 {
  scanf("%lf", &a);
  scanf("%lf", &b);
  scanf("%lf", &c);

  double med = ((a/10) * 2) + ((b/10) * 3) + ((c/10) * 5);

  printf("%.1f\n", med);
 }

 return 0;
}


URI Solution 1079 Weighted Averages Code / URI 1079 Weighted Averages solution in CPP:

#include <cstdio>

int main()
{
 int n;
 double a;
 double b;
 double c;

 scanf("%i", &n);

 for (int i = 0; i < n; ++i)
 {
  scanf("%lf", &a);
  scanf("%lf", &b);
  scanf("%lf", &c);

  double med = ((a/10) * 2) + ((b/10) * 3) + ((c/10) * 5);

  printf("%.1f\n", med);
 }

 return 0;
}

URI Solution 1079 Weighted Averages Code / URI 1079 Weighted Averages solution in Java:

import java.util.Scanner;

public class Main {

 public static void main(String[] args) {
  
  int N;
  float value1, value2, value3;
  float average;
  Scanner input =new Scanner(System.in);
  N = input.nextInt();
  
  for (int i = 1; i <= N; i++) {
   value1 = input.nextFloat();
   value2 = input.nextFloat();
   value3 = input.nextFloat();
   average = ( value1*2 + value2*3 + value3*5 ) / 10;
   System.out.printf("%.1f\n", average);
  }
 }

}

URI Solution 1079 Weighted Averages Code / URI 1079 Weighted Averages solution in  Python:


URI Solution 1079 Weighted Averages Code / URI 1079 Weighted Averages 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 1079 Weighted Averages  code in C, URI 1079 Weighted Averages code in C++, URI Area of a circle solution in C, URI solution, URI 1079 Weighted Averages solution in C,URI 1079 Weighted Averages solution in C++-CPP,URI 1079 Weighted Averages solution in C# (C sharp),URI 1079 Weighted Averages solution in Java,URI 1079 Weighted Averages solution in Python,

1 comment:

  1. this code will get presention error,because you dont kept the output separeted from the input 'for'

    ReplyDelete