Go URI 1007 No Problem
Read four integer values named A, B, C and D. Calculate and print the difference of product A and B by the product of C and D (A * B - C * D).
Input
The input file contains 4 integer values.
Output
Print DIFERENCA (DIFFERENCE in Portuguese) with all the capital letters, according to the following example, with a blank space before and after the equal signal.
Input Samples | Output Samples |
5 6 7 8 | DIFERENCA = -26 |
0 0 7 8 | DIFERENCA = -56 |
5 6 -7 8 | DIFERENCA = 86 |
Solution in C language :
- #include<stdio.h>
- int main()
- {
- int a, b, c, d;
- scanf("%d%d%d%d", &a, &b, &c, &d);
- printf("DIFERENCA = %d\n", a * b - c * d);
- return 0;
- }
Solution in C++ language :
#include<iostream> using namespace std; int main() { int a, b, c, d; cin >> a >> b >> c >> d; cout << "DIFERENCA = " <<a * b - c * d << endl; return 0; }
Solution in Java language :
- import java.util.Scanner;
- public class URI_1007 {
- public static void main(String[] args) {
- Scanner input =new Scanner(System.in);
- int a, b, c, d, difference;
- a = input.nextInt();
- b = input.nextInt();
- c = input.nextInt();
- d = input.nextInt();
- difference = a * b - c * d;
- System.out.print("DIFERENCA = "+ difference +"\n");
- }
- }
To solve more problem in URI solution judge of beginner level at a glance , go to :
To download URI many problem in java language in java language :
Go to