Pages

abdulrehman programmer. Powered by Blogger.

Sunday 8 September 2013

First step to become a programmer: Learn the Basics

Today, I'm going to explain explain to you some basics about programming.
I will show you three basic components of programming.

1) Programming Code
2) Algorithm
3) Pseudo Code
1) Programming code:

It is the main part of a software or programme. It tells the computer what to accept as input, how to process it and when and what to display as the output.
I will show you an example of a simple programming code using Python. If you plan on becomign a good programmer, then I would recommend using Python as your first compiler as it is easier to use for beginners.

Download Python :
After installing open the GUI version of it and enter the code below. (It's not neccessary to download Python , If you can understand the code without it)

Programming code:

# This program can be used to input two numbers and get the sum of those two as output.

a = input("Enter the first number" )
b = input("Enter the second number" )
c = a+b print "The sum of the two numbers is", c

Expressions used :


A = input : This tells the program to accept and save first input as A
B = input : This tells the program to accept and save first input as B
C = a+b : This tells the program to add the values saved in A and B
print "The sum of the two numbers is", c : This tell the program to show the output or display the value of C.
(".......") : The messages inside these boxes are instructions to the users.

Now those who already installed Python can save this as " name.py" and run it!

Example of how it will work:

Enter the first number 1 (I input 1 and pressed Enter)
Enter the second number 3 (I input 3 and press Enter)
4 (This is the output or result)

2)Algorithms:

Algorithms are written in proper English. No programming language is used to write Algorithms.
The Algorithm for the above coding is :

0.Start
1.Make the user enter the first number and save it as A
2.Make the user enter the second number and save it as B
3.Save the sum of A and B as C
4.Display the value of C
5.End

3)Pseudo Code:

Pseudo Code is the documentation for the programmer. It is a mix of different types of symbols used to convey a message.
The Pseudo Code for the above coding is:

0.Start
1.Accept A
2.Accept B
3.C=A+B
4.Display C
5.Stop
Thank you for reading and share this..!

0 comments:

Post a Comment