Question: TECH 1211 Computer ProgrammingName _____________________________ Homework 6 Branching Sort Using Cascaded If or Switch Use the following program to answer questions 1 to 4.The letter
TECH 1211 Computer ProgrammingName _____________________________
Homework 6 Branching Sort Using Cascaded If or Switch
Use the following program to answer questions 1 to 4.The letter in front of the line of code is not part of the code.It is only there to reference in the question as done before.
The program below finds the largest and smallest of four integers entered by the user:
Enter four integers:21 43 10 35
Largest:43
Smallest:10
a#include
bint main()
c{
dint d1, d2, d3, d4, larger12, larger34, largest, smaller12, smaller34, smallest;
eprintf("Enter four integers: " );
fscanf("%d%d%d", &d1,&d2,&d3,&d4);
gif ( d1 > d2) {
hlarger12 == d1;
ismaller12 = d2;
j}else {
klarger12 = d2
lsmaller12 = d1;
m}
nif (d3 > d4) {
olarger34 = d3;
psmaller34 = d4;
q}else {
rlarger34 = d4;
ssmaller34 = d3;
t}
uif(larger12 > larger34) {
vlargest = larger12;
w}else {
xlargest = larger34;
y}
zif(smaller12 < smaller34) {
aasmallest = smaller12;
ab}else {
acsmallest = smaller34;
ad}
aeprintf("Largest: %d ",);
afprintf("Smallest: %d ", smallest);
agreturn 0;
ah }
Highlight the repairs in yellow.
1.There is an error in line f.Fix it.
2.There is an error in line h.Fix it.
3.There is an error in line k.Fix it.
4.There is an error in line ae.Fix it.
5.Draw the flowchart depicting the basic sort process for this program.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
