Starting from:

$30

CSE114-Labwork 1 Solved

LABWORK 1
Write 3 functions and a main function.

Function 1: 

●     Function name: squared_diff1 ●       Return type: integer 2               x              y

●     Function parameter: integer parameters;    and

●     Function calculates and returns 𝑥2 − 𝑦2, if the result is negative, then multiply it with -1.

Function 2: 

●     Function name: squared_diff2 ●       Return type: integer 2               x              y

●     Function parameter: integer parameters;    and it with -1.  (𝑥 − 𝑦) * (𝑥 + 𝑦),

●     Function calculates and returns          if the result is negative, then multiply

The main function :

1.    Ask      and      values from the user (5 pts)

2.    Call squared_diff1 function and calculate its result.x  y             

3.    If the result from step 2 is smaller than 20, ask another        value from the user. Otherwise,

                continue with step 6.                                      y

5.    If the result from step4 is also smaller than 20, then set the value to y           . Otherwise, 4. Call squared_diff1 function again and calculate its result with the new    value. 

                continue with step 6.                                                 y                    x+5

6.    Call squared_diff2 function and calculate its result 

7.    Print “SAME” if both of the values returned from the functions match, print “DIFFERENT” otherwise 

8.    Do the printf and scanf operations only in the main function.

 

More products