(a) Write the syntax of for loop. Describe the difference between the…

Previous year question for Computer Programming.

Question

(a) Write the syntax of for loop. Describe the difference between the for and while loop with suitable example. (10)

(b) Using "switch" statement, write a program to simulate a simple calculator which is used to carry basic operations like addition, subtraction, multiplication and division. The input will be given in infix form. i.e. operand1 operator operand2. (eg: 4+5, 10-4, 12*4, 3/5). (10)

Related pages

More PYQs on Looping

Open on CachedInfo