Online College Courses for Credit

Logic (Mod 7) Programs

Logic (Mod 7) Programs

Author: Jacob Sorem
  • Introduce the structure of a computer program
  • Understand input, output, and algorithms
  • Write a basic program using pseudocode

Computer programs are complicated.  Understanding how they are structured can help in debugging, or finding problems within the program.

See More
Fast, Free College Credit

Developing Effective Teams

Let's Ride
*No strings attached. This college course is 100% free and is worth 1 semester credit.

47 Sophia partners guarantee credit transfer.

299 Institutions have accepted or given pre-approval for credit transfer.

* The American Council on Education's College Credit Recommendation Service (ACE Credit®) has evaluated and recommended college credit for 33 of Sophia’s online courses. Many different colleges and universities consider ACE CREDIT recommendations in determining the applicability to their course and degree programs.



This video is a very basic introduction to programs, focusing on pseudocode. These days, applications can be written in one of dozens of programming languages. While similar in structure, each language can have different syntax and command structure. Think of syntax as the grammar. Much like spoken languages, computer languanges can put things in slightly different order or use different symbols for punctuation. So, to assist, programmers may write a program in pseudocode then later write it in the language that is best.

The idea in writing pseudocode is to follow general programming guidelines. This includes identifying input, output, and algorithms. It is also important to identify variables that will be used in the program. (There are other concepts like parsing and function calls which we won't get into at this introductory level.)

For the purposes of my classes, I am looking for terminology and structure that focuses on input, output, and algorithms. The video uses the sample program from the course to illustrate how pseudocode might look.

Once your pseudocode is written, read back through it and make sure all aspects of the program requirements are met. Test the pseudocode by stepping through it and only doing exactly what it instructs. This is similar to debugging.

Sample Pseudocode

The final pseudocode from the video might look something like this.  Comments are often included in programs.  I have added them here to assist you in understanding the program.


/ Declare Variables.  The parentheses contain the type of variable.

/ Examples of variable types could be "int" for integer, "dec" for decimal, and "str" for string

var(dec) Bill
var(dec) TipPerc
var(dec) TipAmt
var(dec) TotBill

/ Print message to screen asking for user input

Print "Enter bill amount:"
Get Bill
Print "Enter tip percentage:"
Get TipPerc

/ Calculate tip amounts using algorithms

TipAmt = Bill * TipPerc
TotalBill = Bill + TipAmt

/ Print output of algorithm

Print "Tip amount =" TipAmt
Print "Total bill =" TotBill

End Program