Tamil Nadu Board of Secondary EducationHSC Science Class 11th

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 - Computer Science

Advertisement Remove all ads
Advertisement Remove all ads
Advertisement Remove all ads
Short Note

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.

Advertisement Remove all ads

Solution

The specification of the algorithm:
exchange (A, B)
–inputs: A, B are real and >0
–outputs: A, B are real and >0
State representation
TEMP:=A
A:=B
B:= TEMP

Concept: Algorithm Design Techniques
  Is there an error in this question or solution?

APPEARS IN

Tamil Nadu Board Samacheer Kalvi Class 11th Computer Science Answers Guide
Chapter 6 Specification and Abstraction
Evaluation - Section - D | Q 3. | Page 87
Share
Notifications

View all notifications


      Forgot password?
View in app×