URI Online Judge Solution 1010 Simple Calculate - URI 1010 Solution in C, C++, Java, Python and C#
URI Online Judge Solution 1010 Simple Calculate | BeginnerURI Problem Link - https://www.urionlinejudge.com.br/judge/en/problems/view/1010
Problem Name: 1010 Simple Calculate code
Problem Number : URI - 1010 Simple Calculate solution
Online Judge : URI Online Judge Solution
Category: Beginner
Solution Language : C,C plus plus, java, python, c#(c sharp)
URI Solution 1010 Simple Calculate Code/ URI 1010 solution in C:
Simple sense URI 1010 code in C without array
#include <stdio.h> int main() { int a, b; double c, res; scanf("%d %d %lf", &a, &b, &c); res = b * c; scanf("%d %d %lf", &a, &b, &c); res += b * c; printf("VALOR A PAGAR: R$ %.2lf\n", res); return 0; }
URI 1010 code in C with array
#include<stdio.h> int main() { int p_code[2], p_u[2], i; float price[2], pay; for(i=0; i<2; i++) { scanf("%d %d %f",&p_code[i],&p_u[i],&price[i]); } pay=((price[0]*p_u[0])+(price[1]*p_u[1])); printf("VALOR A PAGAR: R$ %.2f\n", pay); return 0; }
URI Solution 1010 Simple Calculate Code / URI 1010 Simple Calculate solution in CPP:
#include <cstdio> using namespace std; int main(int argc, char const *argv[]) { int a, b; double c, res; scanf("%d %d %lf", &a, &b, &c); res = b * c; scanf("%d %d %lf", &a, &b, &c); res += b * c; printf("VALOR A PAGAR: R$ %.2lf\n", res); return 0; }
URI Solution 1010 Simple Calculate Code / URI 1010 Simple Calculate solution in Java:
import java.util.Scanner; public class Main{ public static void main(String[] args) { int a, b; double c, res; Scanner sc = new Scanner(System.in); a = sc.nextInt(); b = sc.nextInt(); c = sc.nextDouble(); res = b * c; a = sc.nextInt(); b = sc.nextInt(); c = sc.nextDouble(); res += b * c; System.out.printf("VALOR A PAGAR: R$ %.2f\n", res); } }
URI Solution 1010 Code / URI 1010 solution in Python:
linha1 = input().split(" ") linha2 = input().split(" ") cod1, qtde1, valor1 = linha1 cod2, qtde2, valor2 = linha2 total = (int(qtde1) * float(valor1)) + (int(qtde2) * float(valor2)) print("VALOR A PAGAR: R$ %0.2f" %total)
URI Solution 1010 Code / URI 1010 solution in C# (C Sharp):
URI Online Judge Solution 1010 Code Demonstration:
First take 3 values in store it in a result variable
Again take 3 value and now just increment the result variable. And solved, in C that is
scanf("%d %d %lf", &a, &b, &c); res = b * c; scanf("%d %d %lf", &a, &b, &c); res += b * c;
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 Simple Calculate code in C, URI 1010 code in C++, URI Simple Calculate solution in C, URI solution, URI 1010 solution in C,URI 1010 solution in C++-CPP,URI 1010 solution in C# (C sharp),URI 1010 solution in Java,URI 1010 solution in Python,
Runtime Error!!!!
ReplyDeletewhy??
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace _1010
{
class URI
{
static void Main(string[] args)
{
int a, b,a2,b2;
double re, sum, c,c2;
a = Convert.ToInt32(Console.ReadLine());
b = Convert.ToInt32(Console.ReadLine());
c = Convert.ToDouble(Console.ReadLine());
re = b*c;
a2 = Convert.ToInt32(Console.ReadLine());
b2 = Convert.ToInt32(Console.ReadLine());
c2 = Convert.ToDouble(Console.ReadLine());
sum = re + (b2 * c2);
Console.WriteLine("VALOR A PAGAR: R$ {0}", sum.ToString("0.00"));
Console.ReadKey();
}
}
}
because of you have given input under by under ...but was needed side by side
Deleteok?