Pascal Programming Language Tutorial #2

in #programming7 years ago

welcome to episode 2 of pascal programming language tutorial. as i say in my first episode. in this episode i'm going to teach you the structure of a program, and how to make a simple program

  1. first go to your fpc, file -> new
  2. here are the structure of a code.
    pascal 2-1.PNG
    i'm going to break it down one by one
    the first one is program. program is used to tell what your name of the program is. as simple as that.
    the second thing is var. var is a function used to declare any variable you want to use later in the code.
    the third thing is begin and end. this is used as a block. so the computer knows where the program start. and when it ends.

this is an example of a simple program works. i'm going to make a program to add 2 numbers together
pascal2-2.PNG

as you can see. the first thing to do is make a program and then put your program name in
next is the variable im using is a and b. where a and b are integers

next i write read(a) which means this program has to take user input in the form of integer. and save the value to the variable a
the same thing happen to read(b)

next i write write (a+b) which litterally just meant to print out the sum of a and b as easy as that

after writing all this code. compile by pressing f9 if this is your first compile, then give the name to this file and press ok

if you have compiled your code successfully, then this message will appear
pascal 2-3.PNG

after compiling, you can press ctrl+f9 to open the program. it should look something like this
pascal 2-4.PNG

now remember. the first thing you want this program to do is get an input for the variable a and b so you can write an integer number for a and b. i'm using 10 and 5
pascal 2-5.PNG

then press enter. the program will gone. but don't worry. you just need to press alt+f5 then the result will appear like this
pascal 2-6.PNG

and then you are done. thats how simple it is to make a program
now try to make a subtraction (-) multiplication (*) and division (/)

thats it for now thanks for reading

Sort:  

Congratulations @keju1123! You have completed some achievement on Steemit and have been rewarded with new badge(s) :

Award for the number of upvotes
Award for the number of upvotes received

Click on any badge to view your own Board of Honor on SteemitBoard.
For more information about SteemitBoard, click here

If you no longer want to receive notifications, reply to this comment with the word STOP

By upvoting this notification, you can help all Steemit users. Learn how here!

Good one bro
Though I lost interest in programming because of time constraint. but you are making it so simple to learn.
weldone.

I am going to follow you and ensure i upvote all you post. just carry me along

thank you ^^ you make me feel motivated ^^

Guy try steemfollower. I just use it and it is cool. just click and login: https://steemfollower.com/?r=3631

Congratulations @keju1123! You received a personal award!

Happy Birthday! - You are on the Steem blockchain for 2 years!

You can view your badges on your Steem Board and compare to others on the Steem Ranking

Vote for @Steemitboard as a witness to get one more award and increased upvotes!

Coin Marketplace

STEEM 0.17
TRX 0.16
JST 0.029
BTC 75263.74
ETH 2718.66
USDT 1.00
SBD 2.46