Algo N Flow Chart of All EC Programs
Algo N Flow Chart of All EC Programs
Algorithm:
1. Start
2. Input two numbers (num1 and num2)
3. Display Menu for user to choose an operation:
Perform Operation
If the choice is ?
End
Program 2: Algorithm and Flow chart of Transfer of data from source to
destination.
3. Initialize the destination memory address (DEST) where data will be transferred.
4. Check if SRC and DEST addresses are valid:
o If valid, proceed.
o If invalid, display an error message and terminate.
5. Retrieve data from SRC:
Flow Chart:
Initialize Source Address (SRC)
| (Yes/No Decision)
Proceed Error Handling
End
Program 3: Sum of first 10 digit number.
Algorithm:
1. Start
2. Initialize a variable to store the sum.
3. Loop through the first 10 digits (1 to 10)
4. Add each number to the sum.
5. Display the final sum
6. End.
Flow chart:
Start
Sum = 0
i = 1 to 10
sum += i
Display sum
End
Program 4: Find a factorial number.
Algorithm:
1. Start
2. Initialize a variable fact to 1.
3. Take input for the number n whose factorial is to be found.
4. Loop from 1 to n.
5. Multiply each number to fact.
6. Display the final factorial value
7. End.
Read n
fact = 1
i = 1 to n
fact *= i
Ex: 5!=120
5!=120
End
Program 5: Square of number (1 to 10) by using look up table.
Algorithm:
1. Start
Start
Flow Chart:
Read n (1-10)
Validate n No
End
Program 6: find the largest/smallest number in an array of 32 numbers.
Algorithm:
1. Start
Loop through
array elements
Update values
Display result
End
Program 7: series of 32 bit numbers in ascending/descending order.
Algorithm:
1. Start
2. Initialize an array with 32-bit numbers.
3. Choose the sorting order (ascending/descending).
4. Use Bubble Sort to compare and swap elements:
Ascending Order: Swap if the left element is greater than the right.
Descending Order: Swap if the left element is smaller than the right.
Start
Flow Chart:
Choose Order
(Ascending / Descendig)
End
Program 8: count the number of ones and zeros in two consecutive memory
locations.
Algorithm:
1. Start
2. Initialize variables to store memory addresses and counters for ones and
zeros.
3. Read data from the two consecutive memory locations.
4. Loop through each bit of the data:
a. If the bit is 1, increment the count of ones.
b. If the bit is 0, increment the count of zeros.
5. Display the counts.
6. End.
Start
Flow chart:
Initialize variables
And
Display counts/results
End