[URI Online Judge] – 1007 – Difference

Make a simple program that reads four variables named A, B, C and D. Calculate and print the difference of the product of A and B with the product of C and D (A * B – C * D).

Input

The input file contains 4 integer numbers.

Output

Print DIFERENCA (DIFFERENCE in portuguese) according to the following example, with a blank space before and after the equal signal.

Sample Inputs Sample Outputs
5
6
7
8
DIFERENCA = -26
0
0
7
8
DIFERENCA = -56
5
6
-7
8
DIFERENCA = 86

Solution:

#include <cstdio>

int main(){
int a, b, c, d;
scanf(“%d”, &a);
scanf(“%d”, &b);
scanf(“%d”, &c);
scanf(“%d”, &d);
printf(“DIFERENCA = %d\n”, a * b – c * d);
return 0;
}

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s