URI Online Judge 1006 | (Average 2) Solution

Solve of URI 1006 (Average 2) in C & C++


Problem Description of URI Online Judge 1006:


Problem number:
1006.
Problem name: Average 1.
Problem level: 1.
Problem category: Beginner.
Points: 1.4 points
Base time limit: 1 second.
Memory limit: 200 MB.
Problem subject: Sequential.
Problem adapted by: Neilor Tonin (Brazil).
Link: https://www.urionlinejudge.com.br/judge/en/problems/view/1005
Solution language: C & C++
My profile: https://www.urionlinejudge.com.br/judge/en/profile/38770



Solution of URI 1006 in C:


//URI online judge 1006 solution in C
//This solution is made and uploaded by Mehedi Hasan Kajol 
#include<stdio.h>
int main(void){
     float a, b, c, average;
     scanf("%f%f%f", &a, &b, &c);
     average = ( a*2.0 + b*3.0 + c*5.0) / 10.0;
     printf("MEDIA = %.1f\n", average);
     return 0;
}


Solution of URI 1006 in C++:


//URI online Judge 1006 solution in C++
//This solution is made and uploaded by Mehedi Hasan Kajol 
#include<iostream>

using namespace std;
int main(void){
     float a, b, c, average;
     cin >> a >> b >>c;
     average = ( a*2.0 + b*3.0 + c*5.0 ) / 10.0;
     printf("MEDIA = %.1f\n", average); //printf() for precision.
     return 0;
}


Post a Comment

Previous Post Next Post