Write a programing logic and pseudocode to find the largest
Write a programing logic and pseudocode to find the largest value among 4 separate variables.Assume there are 4 boxes( box A, box B, box C and box D) and each of them contain money. Your if else logic must find the box that has the largest(maximum money).
Please write the detailed pseudocode.
Solution
Given : boxA, boxB, boxC and boxD
maxBox = boxA; // initializing maxBox with boxA
// now comparing maxBox with all other remaining boxes and changing maxBox value if any other
// is greater
// if maxBox is lesser than boxB
if(maxBox < boxB)
maxBox = boxB
if(maxBox < boxC)
maxBox = boxC
if(maxBox < boxD)
maxBox = boxD
Now, maxBox store the max among all box
