URI Online Judge Solution 1006 Average 2 – Solution in C, C++, Java, Python and C#

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

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

URI Online Judge Solution 1006 Average 2 - Solution in C, C++, Java, Python and C#
URI Online Judge Solution 1006 Average 2 – Solution in C, C++, Java, Python and C#
See a video if you have some time – 
URI 1006 solution Video – 

URI Solution 1006 Average 2 Code in C:

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

double
a, b, c, media;
scanf("%lf%lf%lf", &a, &b, &c);
media = (a/10 * 2) + (b/10 * 3) + (c/10 * 5);
printf("MEDIA = %.1lfn", media);
return
0;
}

URI Solution 1006 Average 2 Code C++/ URI 1006 Average 2 solution in CPP:

#include <iostream>
#include <iomanip>
using namespace std;

int
main()
{

double
a, b, c, media;
cin >> a >> b >> c;
media = (a/10 * 2) + (b/10 * 3) + (c/10 * 5);
cout << "MEDIA = "<< fixed << setprecision(1) << media << endl;
return
0;
}

URI Solution 1006 Average 2 Code in java / URI 1006 Average 2 solution in Java:

import java.util.Scanner;

public class
Main{
public static
void main(String[] args){

double
a, b, c, med;
Scanner sc =new Scanner(System.in);

a =sc.nextDouble();
b =sc.nextDouble();
c =sc.nextDouble();

med = (a/10 * 2) + (b/10 * 3) + (c/10 * 5);
String media = String.format("MEDIA = %,.1f", med);

System.out.print(media +"n");

}
}

URI Solution 1006 Average 2 Code / URI 1006 Average 2 solution in  Python:

a = float(input())
b = float(input())
c = float(input())

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

print("MEDIA = %0.5f" %media)

URI Solution 1006 Average 2 Code / URI 1006 Average 2 solution in  C# (C Sharp):



using
System;
class
URI {

static
void Main(string[] args) {

double
a, b, c;
a = Convert.ToDouble(Console.ReadLine());
b = Convert.ToDouble(Console.ReadLine());
c = Convert.ToDouble(Console.ReadLine());

Console.WriteLine("MEDIA = " + ((a/10 * 2) + (b/10 * 3) + (c/10 * 5)).ToString("0.00000"));
Console.ReadKey();

}
}

Demonstration:

Since in the question, it has told that each grade has grown from 0 to 10, so devide it with 10 and multiplication into with their weight. Just main line is this,

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

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 2 code in C, URI 1006 Average 2 code in C++, URI Area of a circle solution in C, URI solution, URI 1006 Average 2 solution in C,URI 1006 Average 2 solution in C++-CPP,URI 1006 Average 2 solution in C# (C sharp),URI 1006 Average 2 solution in Java,URI 1006 Average 2 solution in Python,

By Maniruzzaman Akash

Maniruzzaman Akash is a freelance web developer with most popular Laravel PHP frameork and Vue JS

Leave a Reply

Your email address will not be published. Required fields are marked *