You are on page 1of 10

Step 1:Star

Step 2:Read three numbers A,B & C

Step 3:If A>B,then go to step 6

Step 4:If B>C,then print B & go to step 8

Step 5:print C is greatest & go to step 8

Step 6:If A>C,then print A is greatest & go to step 8

Step 7:Print C is greatest

Step 8:end

Flowchart for Area of Circle:


Area = π*r*r
Flowchart for Circumference of Circle:

What Is a Programming Algorithm?


So, what is a programming algorithm? You can think of a programming algorithm as a recipe that
describes the exact steps needed for the computer to solve a problem or reach a goal. We've all
seen food recipes - they list the ingredients needed and a set of steps for how to make the described
meal. Well, an algorithm is just like that. In computer lingo, the word for a recipe is a procedure, and
the ingredients are called inputs. Your computer looks at your procedure, follows it to the letter, and
you get to see the results, which are called outputs. 

Programming Algorithm Example


Okay, you probably wish you could see an example, right? So, what exactly does an algorithm in
programming look like? Well, asking a user for an email address is probably one of the most
common tasks a web-based program might need to do, so that is what we will use here for an
example. An algorithm can be written as a list of steps using text or as a picture with shapes and
arrows called a flowchart. We will make one of each which you will see here:
Wasn't that easy? Notice how the top of our example is just a numbered list of steps using plain
English, stating exactly what we want the procedure to do (no more, no less). The bottom is the very
same algorithm, but this time, we used shapes and arrows in a flowchart (like a map of the route), so
that a reader can visualize the journey. That's a nice thing here, because in one of our steps (step 7)
a decision must be made and, depending on the result of that decision, our steps may not go in
order from start to end.
Okay! Let's take a quick run through our little recipe:
1. Step 1 is really just a reminder that this is a procedure with a beginning and an end.
2. In step 2, we make a place in the computer to store what the user types in, also called a variable
3. In step 3, we clear this variable because we might need to use it again and don't want the old
contents mixed in with the new.
4. In step 4, we prompt the user for an email address
5. In step 5, we stick it in our nifty variable.
6. In step 6, we tell our computer to take a close look at this email address-- is it really an email
address?

Flowchart In Programming
A flowchart is a diagrammatic representation of an algorithm. A flowchart can
be helpful for both writing programs and explaining the program to others.

Symbols Used In Flowchart


Symbol Purpose Description

Flow line Indicates the flow of logic by connecting symbols.

Terminal(Stop/Start) Represents the start and the end of a flowchart.

Input/Output Used for input and output operation.

Processing Used for arithmetic operations and data-manipulations.

Decision Used for decision making between two or more


alternatives.

On-page Connector Used to join different flowline

Used to connect the flowchart portion on a different


Off-page Connector
page.

Predefined Represents a group of statements performing one


Process/Function processing task.

Examples of flowcharts in programming

1. Add two numbers entered by the user.

Variables are used to store information to be referenced and manipulated in a


computer program. They also provide a way of labeling data with a descriptive
name, so our programs can be understood more clearly by the reader and
ourselves. It is helpful to think of variables as containers that hold information. Their
sole purpose is to label and store data in memory. This data can then be used
throughout your program.

Assigning Value to Variables

Naming variables is known as one of the most difficult tasks in computer


programming. When you are naming variables, think hard about the names. Try
your best to make sure that the name you assign your variable is accurately
descriptive and understandable to another reader. Sometimes that other reader is
yourself when you revisit a program that you wrote months or even years earlier.

When you assign a variable, you use the = symbol. The name of the variable goes
on the left and the value you want to store in the variable goes on the right.

A reserved word may refer to any of the following:

1. Often found in programming languages and macros, reserved


words are terms or phrases appropriated for special use that may not
be utilized in the creation of variable names. For example, "print" is a
reserved word because it is a function in many languages to show text
on the screen.

2. Reserved words are used in operating systems as a method of


identifying a device file or another service. Below is a listing of
Microsoft reserved words in MS-DOS and Windows operating systems.
When attempting to use any of the following reserved words as a file
name or command, you may receive an error message. For example,
attempting to save a file as CON or CON.txt may generate a reserved
file name or access denied error or say the file already exists.

he following are more examples of reserved words. abstract , if , private , this , double
, implements , throw , boolean , else , import , public , throws , break , return , byte ,
extends , int , short , true , false , case , interface , static , try , catch , final , long , void .

Computer programming is the process that professionals use to write code that


instructs how a computer, application or software program performs. At its most
basic, computer programming is a set of instructions to facilitate specific actions.The
purpose of programming is to find a sequence of instructions that will automate the
performance of a task (which can be as complex as an operating system) on a
computer, often for solving a given problem.

Errors There are three kinds of errors: syntax errors, runtime errors, and logic errors. These
are errors where the compiler finds something wrong with your program, and you can't even try
to execute it. For example, you may have incorrect punctuation, or may be trying to use a
variable that hasn't been declared. The 7 Most Common Types of Errors in
Programming and How to Avoid Them

1. Syntax Errors. Just like human languages, computer languages have grammar rules. ...
2. Logic Errors. Logic errors can be the hardest to track down. ...
3. Compilation Errors. ...
4. Runtime Errors. ...
5. Arithmetic Errors. ...
6. Resource Errors. ...
7. Interface Errors.
Loops are a programming element that repeat a portion of code a set number of times
until the desired process is complete. Repetitive tasks are common in programming, and
loops are essential to save time and minimize errors. What are the 3 types of loops?

Loops are control structures used to repeat a given section of code a certain number of
times or until a particular condition is met. Visual Basic has three main types of
loops: for.. next loops, do loops and while loops.

Flowchart of a program that contains a for


loop¶
Below is the description of a program that can be coded with a for loop:

The program starts. The program prints the word “looping” 10 times. Finally, the program
ends.
A flowchart that describes this program is shown.
# start

for i in range(10):

print("looping")

# end

Flowchart of a program that contains a


while loop
Below is the description of a program which can be coded with a while loop:

The program starts. The program asks the user for a positive number. If the number is
negative, the program asks the user for a positive number again. If the number is positive,
the program prints “positive”. Finally, the program ends.
A flowchart that describes this program is shown.
# start

num = -1

while num < 0:

num = input("Enter a positive number: ")

num = float(num)

print("positive")

# end

A compiler is a program that translates a source program written in some high-level
programming language (such as Java) into machine code for some computer architecture
(such as the Intel Pentium architecture). ... For a example, a Java interpreter can be completely
written in C, or even Java. Assembler is a program for converting instructions written in
low-level assembly code into relocatable machine code and generating along information
for the loader. It generates instructions by evaluating the mnemonics (symbols) in operation
field and find the value of symbol and literals to produce machine code.t produces a machine
code in form of mnemonics. It produces binary code in form of 0s and 1s. Examples are Java,
C, C++ etc. compilers. Examples of assemblers are GAS, GNU etc.

Interpreter. An interpreter translates code into machine code, instruction by instruction -


the CPU executes each instruction before the interpreter moves on to translate the next
instruction. Interpreted code will show an error as soon as it hits a problem, so it is easier to
debug than compiled code. An Interpreter directly executes instructions written in a
programming or scripting language without previously converting them to an object code or
machine code. Examples of interpreted languages are Perl, Python and Matlab. ... For
interpreted programs, the source code is needed to run the program every time.

Write algorth

You might also like