Algorithm


Problem Name: beecrowd | 1007

Problem Link: https://www.beecrowd.com.br/judge/en/problems/view/1007?origem=1

Algorithm:

((A * B) - (C * D))

Problem Detail: beecrowd | 1007

Difference

Adapted by Neilor Tonin, URI Brazil

Timelimit: 1

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

 

Code Examples

#1 Code Example with C Programming

Code - C Programming


#include <stdio.h>
int main() {
 
    int A , B , C , D, difference;

    scanf("%d %d %d %d", &A , &B ,&C, &D);

    difference=((A * B) - (C * D));

    printf("DIFERENCA = %d\n", difference);

    return 0;

}
Copy The Code & Try With Live Editor

Input

x
+
cmd
5
6
7
8

Output

x
+
cmd
DIFERENCA = -26

#2 Code Example with C++ Programming

Code - C++ Programming




#include <stdio.h>
int main() {
 
    int A , B , C , D, difference;

    scanf("%d %d %d %d", &A , &B ,&C, &D);

    difference=((A * B) - (C * D));

    printf("DIFERENCA = %d\n", difference);

    return 0;

}


Copy The Code & Try With Live Editor

Input

x
+
cmd
0
0
7
8

Output

x
+
cmd
DIFERENCA = -56

#3 Code Example with Java Programming

Code - Java Programming


import java.util.Scanner;
public class Main {
    public static void main(String[] args){

      int A , B , C , D, difference;
      Scanner sc = new Scanner(System.in);
      A = sc.nextInt();
      B = sc.nextInt();
      C = sc.nextInt();
      D = sc.nextInt();

  difference=((A * B) - (C * D));

  System.out.printf("DIFERENCA = %d\n", difference);
  }
}
Copy The Code & Try With Live Editor

Input

x
+
cmd
0
0
7
8

Output

x
+
cmd
DIFERENCA = -56

#4 Code Example with Python Programming

Code - Python Programming


a= int(input())
b= int(input())
c= int(input())
d= int(input())

difference=((a * b) - (c * d))

print("DIFERENCA = %d" %difference)
Copy The Code & Try With Live Editor

Input

x
+
cmd
5
6
-7
8

Output

x
+
cmd
DIFERENCA = 86

#5 Code Example with C# Programming

Code - C# Programming


using System;
class URI {

    static void Main(string[] args) {
            int a, b, c, d, difference;
            a = Convert.ToInt32(Console.ReadLine());
            b = Convert.ToInt32(Console.ReadLine());
            c = Convert.ToInt32(Console.ReadLine());
            d = Convert.ToInt32(Console.ReadLine());

            difference = ((a * b) - (c * d));

            Console.WriteLine("DIFERENCA = " + difference);
            Console.ReadKey();
    }
}
Copy The Code & Try With Live Editor

Input

x
+
cmd
5
6
-7
8

Output

x
+
cmd
DIFERENCA = 86
Advertisements

Demonstration


 #1007 Beecrowd Online Judge Solution 1007 Solution C, C++, Java, Python

Previous
#1006 Beecrowd Online Judge Solution 1006 Average 2 - Solution in C, C++, Java, Python and C#
Next
#1008 Beecrowd Online Judge Solution 1008 Salary Solution in C, C++, Java, Python and C#