Draw a flowchart for a computer program to receive 40 numbers
and output “yes” if number of negative values among the first 10
inputs is equal to number of positive values among the last 10
inputs. Note. The 20 numbers in middle are ignored. For instance,
if the values are:
1,-1,1,1,-1,1,-2,5,1,1,4,4,5,-6,5,8,-12,0,2,0,1,2,3,7,7,-7,0,1,1,1,3,4,1,-1,-1,-1,-1,-1,-1,-1
the program should output “yes” since the number of negative values
in the first 10 numbers is 3, and the number of positive values in
the last 10 numbers is 3 too. As another example, if the values
are:
1,0,1,0,1,2,1,0,-1,-1,0,0,0,1,1,1,-5,-6,0,0,1,-12,-12,-1,-1,1,1,1,1,1,1,0,-1,0,1,-2,1,2,1,1
the program should output “no” because number of negative values in
the first 10 numbers (1,0,1,0,1,2,1,0,-1,-1,) is 2 but number of
positive values in the last 10 numbers (1,0,-1,0,1,-2,1,2,1,1) is
6. Note that we do not count zeros neither as negative nor as
positive.
The entire flowchart has been added in two snippets for a better quality image.
Hope this resolves your doubt.
Please give an upvote if you liked my solution. Thank you :)
Get Answers For Free
Most questions answered within 1 hours.