Wednesday, December 2, 2015

Uri problem 1007 solve

Problem :

Difference

Adapted by Neilor Tonin, URI  Brazil
Timelimit: 1
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 InputsSample Outputs
5
6
7
8
DIFERENCA = -26
0
0
7
8
DIFERENCA = -56
5
6
-7
8
DIFERENCA = 86

Solution:


#include <stdio.h>
  
int main() {
  
int A , B , C , D , DIFERENCA ;
    scanf("%d %d %d %d",&A,&B,&C,&D);
    DIFERENCA =((A*B)-(C*D));
    printf("DIFERENCA = %d\n",DIFERENCA);
     
    return 0;
}

No comments:

Post a Comment