Computer Science, asked by adgs7, 4 months ago

Exchange the contents: Given two glasses marked A and B. Glass A is full of apple drink and glass B is full of grape drink. For exchanging the contents of glasses A and B, represent the state by suitable variables, and write the specification of the algorithm.​

Answers

Answered by amansingh2492006
0

Explanation:

Let the variables a, b, c represent the glass A, glass B and Glass C respectively. Variables A, B, C can store values APPLE, GRAPE or EMPTY. Specification: 1. Exchange ( ) 2. – – inputs: a, b, c := APPLE, GRAPE, EMPTY 3. – – outputs: a, b,c: = GRAPE, APPLE, EMPTYRead more on Sarthaks.com - https://www.sarthaks.com/1024916/exchange-the-contents-given-glasses-marked-glass-full-apple-drink-glass-full-grape-drink

Similar questions