English
Tamil Nadu Board of Secondary EducationHSC Science Class 11

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. Write the specification for exchanging the contents - Computer Science

Advertisements
Advertisements

Question

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. Write the specification for exchanging the contents of glasses A and B, and write a sequence of assignments to satisfy the specification.

Short Note

Solution

The sequence of assignments to satisfy the specification:
exchange(A, B)
–inputs : A, B are real and > 0
–outputs: A, B are real and > 0
State representation
T = A
A: = B
B: = T

shaalaa.com
Composition
  Is there an error in this question or solution?
Chapter 7: Composition and Decomposition - Evaluation - Section - D [Page 101]

APPEARS IN

Samacheer Kalvi Computer Science [English] Class 11 TN Board
Chapter 7 Composition and Decomposition
Evaluation - Section - D | Q 1. | Page 101
Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×