In: Computer Science
(Do the algorithm and flowchart)
Write a C++ program that reads integer numbers and print it in horizontal order of the screen
1. Firs we are going to write the algorithm for the following question :
Step 1: Start Step 2: Declare the variable n, i and array arr Step 3: Initialize the variable arr[] <- {1,2,3,4,5,6} n <- size of array arr i <- 0 Step 4: Repeat the steps until i < n 4.1: Read the value of array index arr[i] 4.2: Display the value of arr index arr[i] 4.3: Increament the value of i i <- i + 1 Step 7: Stop
Explanation :
1. Here we are simply taken 3 variable an array arr, an var n which stores the size of array and and var i for accessing array index
2. In Step 3 we initialize all three variables
2. we then execute a while untill the value of i is less than the size of n and print the value at each index of array and also increment he variable i
-----------------------------------------------------------------------------------------------------------------------------------------------------------------
2. FlowChart :
Above flowchart is self explanatory, however if you feel any doubt lease feel to ask.