Starting from:

$25

Assignment 1  Program Design

Assignment 1
 Program Design

1. Write a program that inputs 4 integer numbers a, b, c and d and checks whether the sum
of the two largest numbers is the same as the squared difference of the two smallest
numbers.
Files:
You are provided with the file Assignment1.c
Complete the missing code. Do not rename the file!
Output format:
[sum of two largest numbers] [“equals” or “does not equal”] [difference of two smallest numbers squared]
Grading:
Your code will be tested with 9 regular test case inputs (10 points each) and 2
special test case inputs (5 points each)
Submission:
Submission should be done only through Blackboard.
Compiling and testing:
To compile your file make sure the Makefile and Assignment1.c files are in
the same directory. Type “make” in the terminal in the directory of the
files. If there are no compilation errors a main executable will be created.
To test your program run “./main” from the terminal in the directory of the
files and then enter the input “a b c d”.
Following are three examples of an input and output. Your program should not
assume that the inputs are integers. If the input format is invalid then the output of
your program should be “INVALID INPUT”
----------------------------------------------------------------------------------------------------------------------------
Example 1:
----------------------------------------------------------------------------------------------------------------------------
Input:
10 40 20 60
Note: Need to check if the sum of the two largest numbers (40+60) is the same as the difference
of the two smallest numbers squared (10-20)^2
Output:
100 equals 100
----------------------------------------------------------------------------------------------------------------------------
Example 2:
----------------------------------------------------------------------------------------------------------------------------
Input:
5 40 20 60
Output:
100 does not equal 225
----------------------------------------------------------------------------------------------------------------------------
Example 3:
----------------------------------------------------------------------------------------------------------------------------
Input:
5 40a 20c 6r0
Output:
INVALID INPUT

More products