100% found this document useful (1 vote)
791 views

Algorithm and Flowchart Example

The document describes an algorithm to print "Hello World" 10 times using a loop. 1. Initialize a counter variable to 0. 2. Print "Hello World" and increment the counter by 1. 3. Check if the counter is less than 10, and if so, repeat printing and incrementing until the counter reaches 10.

Uploaded by

Wowpogi James
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
791 views

Algorithm and Flowchart Example

The document describes an algorithm to print "Hello World" 10 times using a loop. 1. Initialize a counter variable to 0. 2. Print "Hello World" and increment the counter by 1. 3. Check if the counter is less than 10, and if so, repeat printing and incrementing until the counter reaches 10.

Uploaded by

Wowpogi James
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 6

PRINT HELLO WORLD 10 TIMES

This problem is also solved using the loop concept. We take a variable
count and set it to zero. Then we print "Hello World" and increment count by
1.
i.e., count = count + 1
Next we check if count is less than 10. If this is TRUE then we again print
"Hello World" and increment the variable count. On the other hand if the
condition if FALSE then we will stop.

Algorithm (in simple English)

1. Initialize count = 0    (PROCESS)


2. Print Hello World    (I/O)
3. Increment count by 1 (PROCESS)
4. Is count < 10 (DECISION)
5. If count = 10, STOP
CALCULATE THE INTEREST OF A BANK DEPOSIT
Algorithm:
•Step 1: Input amount,
•Step 2: Input years,
•Step 3: Input rate,
•Step 4: Calculate the interest with formula "Interest=Amount*Years*Rate/100
•Step 5: Print interest,
    
DETERMINE WHETHER A TEMPERATURE
IS BELOW OR ABOVE THE FREEZING
POINT

Algorithm:

Step 1: Input temperature,


Step 2: If it is less than 32, then print "below freezing
point", otherwise print "above freezing point"
DRAW A FLOWCHART TO LOG IN TO FACEBOOK
ACCOUNT
This problem can be solved in many ways so, we will encourage you to think and draw a
flowchart for this problem using your imagination.

To log in to facebook account we first enter the facbook URL www.facebook.com in our
browser like Google, Firefox, Safari, Internet Explorer etc. This request is sent to the
facebook server and it responds by sending us the home page of facebook.
Next, we enter our registered Email ID and Password and click the Login button.
Then our login credential is checked. If it is correct, we are show our profile. On the other
hand, if the login credential is wrong then an error occurs and we are prompted to re-enter
our Email ID and Password.

Algorithm (in simple English)

1. Enter www.facebook.com in your browser.  (I/O)


2. facebook Home page loads   (PROCESS)
3. Enter your Email ID and Password    (I/O)
4. Is Email ID and Password Valid (DECISION)
5. Display Account
Determine Whether A Student Passed the
Exam or Not:

Algorithm:

•Step 1: Input grades of 4 courses M1, M2, M3 and M4,


•Step 2: Calculate the average grade with formula
"Grade=(M1+M2+M3+M4)/4"
•Step 3: If the average grade is less than 60, print "FAIL",
else print "PASS".
COUNT AND PRINT FROM 1 TO 10

Algorithm:

Step 1: Input Low(1), High(10)


Step 2: Count = 1
Step 4: While (Count £ High)
Repeat steps 4 through 6
Step 5: Print Count
Step 6: Count = Count + 1

You might also like