Chapter 1. Introduction to computer and programming
chapter 1. Introduction to computer and programming
Question 1. Draw a flow chart to do the sum of 10 elements read from the user.
Question 2. Write an algorithm and draw a flowchart to print first N Fibonacci numbers.
- Start
- Declare variables i, a,b , show
- Initialize the variables, a=0, b=1, and show =0
- Enter the number of terms of Fibonacci series to be printed
- Print First two terms of series
- Use loop for the following steps
-> show=a+b
-> a=b
-> b=show
-> increase value of i each time by 1
-> print the value of show - End
Question 3. Write an algorithm for finding odd and even number from given two numbers.
Step 1 : Start
Start 2 : Read n
Start 3 : if (n%2 == 0), Write " even number" else Write " odd number"
Start 4 : Stop
Question 4. Draw flowchart menu driven C program for simple calculator.
Question 5. Write an algorithm and draw the flow chart to find the largest of the given three numbers – A, B and C.
Algorithm:
Step 1 : Start
Start 2 : Input a, b, c
Start 3 : if a > b goto step 4, otherwise goto step 5
Start 4 : if a > c goto step 6, otherwise goto step 8
Start 5 : if b > c goto step 7, otherwise goto step 8
Start 6 : Output "a is the largest", goto step 9
Start 7 : Output "b is the largest", goto step 9
Start 8 : Output " c is the largest", goto step 9
Start 9 : Stop
Flowchart:
Comments
Post a Comment