(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)
- Year: 2018
- Subject: Computer Programming
Related pages
- Looping — topic
- Computer Programming syllabus
More PYQs on Looping
- a) Different types of loops in C with syntax and example. (8) b) Explain the use of break and continue statements in loops with example. (6) c) Design and Deve…
- (a) Explain different Decision-making and Looping Statements with example. (10) (b) Discuss various storage classes used in C with suitable example. (10)
- (a) What is the use of loop? Describe the syntax and purpose of while, do-while and for loop using programming example. (10) (b) Explain bitwise, increment and…
- (a) What are loop constructs? Discuss various loop constructs used in c? (b) Write a program to find the greatest among three numbers.
- (a) Discuss the syntactic rules to be followed while using goto statement ? Are there any restrictions that apply where control can be transferred in a C progr…
- (c) Write a program in C to print the numbers which are divisible by 7 in the range 7 to 100 using while loop.
- 2. (a) Write a C program to generate and print the numbers between 100 and 200 which are divisible by 3 but not divisible by 4.
- (a) Explain the difference between Entry and Exit control loop. Write a loop statement to print numbers from 10 to 1. (b) Give the syntax and application of ne…
- (b) Explain the for loop and nested for loop with suitable examples.
- (a) Differentiate between while and do-while loop structures with examples. (10) (b) Write a program to generate the Fibonacci series up to n. (10)