SlideShare a Scribd company logo
Pascal Programming Language
Omar ElSabek & Fayez Ghazzawi
IT Engineering
3th year – UNKNOWN Department
•Quiet!!!!!!!!!!
•Pay the fine! :P :D
•Being late!
•Talking!
•Procedures and Functions
• The most important material
• which are very important and you
should keep on practicing more
often.
• Pascal provides two kinds of subprograms:
•Functions : these subprograms return a single value.
•Procedures : these subprograms do not return a value directly.
•Proceduresare just like small programs.
• Sometimes they are called sub--programs.They help the programmer to avoid
repetitions.
• A procedure start off with a begin and ends up with an end;.
• It can also have its own variables, which cannot be used with the main-program.
Procedure Procedure name( Var Variable Name : Type );
Program Lesson1_Program1 (input,output);
Var
Procedure Square(X : Integer; Var y : Integer);
var
Begin
…………
End;
Begin
………….
End.
New knowledge aboutVariables !
There is aTwo type of Variables :
Global Variables :
That which we define in ProgramVar
Local Variable :
ThatWhich we define inside of our procedure/function or
in procedure/function signature
What is the signature !!!
What is the signature !!!
Procedure Procedure name( Var Variable Name : Type );Var Variable Name : Type
What is the prototype {define} !!!
What is the prototype !!!
Procedure Procedure name( Var Variable Name : Type );
Program Lesson1_Program1 (input,output);
Var
Z :integer ;
Procedure Square(X : Integer; Var y : Integer);
var
moxo :real ;
Begin
…………
End;
Begin
………….
End.
Program Lesson1_Program1 (input,output);
Var
Z :integer ;
Procedure Square(X : Integer ; Var y : Integer);
var
moxo :real ;
Begin
…………
End;
Begin
………….
End.
When you declare parameters to a
procedure, variables must separated
by a semi-colon ";".They are put in
between the brackets, following the
procedure name.
Program Lesson1_Program1 (input,output);
Var
X , Z : integer ;
Procedure Square(R : Integer ; Var Result : Integer);
Begin
Result := R * R ;
End;
Begin
Readln(X);
Square(X,Z);
Writeln('The square of X is: '); Writeln( Z );
End.
Program Lesson1_Program1 (input,output);
Var
X , Z : integer ;
Procedure Square(R : Integer);
Var
Result : Integer;
Begin
Result := R * R ;
writeln ('The square of X is: ' , Result);
End;
Begin
Readln(X);
Square(X);
End.
•Let’sTalk a little bit a bout our built in function !!
• ABS( -5 ) 5
• Chr( 97 ) a
• Ord( ‘ a ’ ) 97
• Sin(x) Cos(x)
• Pred( 6 ) 5
• Sqr( 3 ) 9
• Sqrt( 9 ) 3
• Odd( 3 ) True
• Even( 3 ) False
• Succ ( 5 ) 6
• Round( 3.14 ) 3
• Round( 3.64 ) 4
•FunctionareThe second type of sub-program .
• The only difference from the procedure is that the Function return a value at the
end.
• A Function start off with a begin and ends up with an end;.
• It can also have its own variables, which cannot be used with the main-program.
Function FunctionName(Var VariableName:Type): Return Type;
Program Lesson1_Program1 (input,output);
Var
Function Square(X : Integer): Integer ;
var
Begin
…………
End;
Begin
………….
End.
Program Lesson1_Program1 (input,output);
Var
X , Z : integer ;
Function Square(R : Integer) : Integer;
Begin
Square := R * R ;
End;
Begin
Readln(X);
Z:= Square(X);
Writeln('The square of X is: '); Writeln( Z );
End.

More Related Content

What's hot (19)

PPT
Different loops in C
Md. Arif Hossain
 
PPTX
C++ loop
Khelan Ameen
 
PPT
Iteration
Liam Dunphy
 
PPTX
Storage classes in C
Self employed
 
PPTX
Storage classes in c language
tanmaymodi4
 
PPTX
Loops in C Programming Language
Mahantesh Devoor
 
PDF
Algorithm and Programming (Looping Structure)
Adam Mukharil Bachtiar
 
PPT
Looping statements in Java
Jin Castor
 
PPTX
The Loops
Krishma Parekh
 
PDF
Loops in C Programming | for Loop | do-while Loop | while Loop | Nested Loop
Priyom Majumder
 
PPTX
Loops
SAMYAKKHADSE
 
PPTX
Looping and switch cases
MeoRamos
 
DOCX
Looping statements
Chukka Nikhil Chakravarthy
 
PPTX
Storage Classes and Functions
Jake Bond
 
PPTX
Storage classes
Puneet Rajput
 
PPTX
C++ decision making
Zohaib Ahmed
 
PPTX
Turbo pascal
Vien Rivera
 
Different loops in C
Md. Arif Hossain
 
C++ loop
Khelan Ameen
 
Iteration
Liam Dunphy
 
Storage classes in C
Self employed
 
Storage classes in c language
tanmaymodi4
 
Loops in C Programming Language
Mahantesh Devoor
 
Algorithm and Programming (Looping Structure)
Adam Mukharil Bachtiar
 
Looping statements in Java
Jin Castor
 
The Loops
Krishma Parekh
 
Loops in C Programming | for Loop | do-while Loop | while Loop | Nested Loop
Priyom Majumder
 
Looping and switch cases
MeoRamos
 
Looping statements
Chukka Nikhil Chakravarthy
 
Storage Classes and Functions
Jake Bond
 
Storage classes
Puneet Rajput
 
C++ decision making
Zohaib Ahmed
 
Turbo pascal
Vien Rivera
 

Viewers also liked (11)

PDF
Algorithm and Programming (Introduction of dev pascal, data type, value, and ...
Adam Mukharil Bachtiar
 
PPT
Internet, Email, Operating System Concepts2
Nisa Peek
 
PDF
Gimp-manimaran
rmanimaran
 
PDF
Functions in python
Ilian Iliev
 
PPTX
Ligtas at Responsableng Paggamit ng Computer, Internet at Email
Marie Jaja Tan Roa
 
PDF
G.C.E O/L ICT Short Notes Grade-11
Mahesh Kodituwakku
 
PPTX
Pascal Programming Language
Reham AlBlehid
 
PPT
Presentation1.Ppt Email And Internet
aggregate
 
PPT
Pascal Programming Session 1
Ashesh R
 
PDF
Pascal programming language
Mahesh Kodituwakku
 
PPTX
Introduction of Cloud computing
Rkrishna Mishra
 
Algorithm and Programming (Introduction of dev pascal, data type, value, and ...
Adam Mukharil Bachtiar
 
Internet, Email, Operating System Concepts2
Nisa Peek
 
Gimp-manimaran
rmanimaran
 
Functions in python
Ilian Iliev
 
Ligtas at Responsableng Paggamit ng Computer, Internet at Email
Marie Jaja Tan Roa
 
G.C.E O/L ICT Short Notes Grade-11
Mahesh Kodituwakku
 
Pascal Programming Language
Reham AlBlehid
 
Presentation1.Ppt Email And Internet
aggregate
 
Pascal Programming Session 1
Ashesh R
 
Pascal programming language
Mahesh Kodituwakku
 
Introduction of Cloud computing
Rkrishna Mishra
 
Ad

Similar to Function procedure c6 c7 (20)

PPTX
Functions
Septi Ratnasari
 
PPTX
Modular programming
BeebashPokhrel
 
PPTX
9. DBMS Experiment Laboratory PresentationPPT
TheVerse1
 
PPTX
Subroutines igcses computer science powerpoint
kireraruby
 
PDF
modularization-160202092213 (1).pdf
SreeramBaddila
 
PPTX
SAP Modularization techniques
Jugul Crasta
 
PDF
Apple IIgs Programming (K Fest)
Polymorph
 
PDF
Modular programming in qbasic
Cavite National Science High School
 
PPTX
Presentation of computer
SabinDhakal13
 
PPTX
Problem Solving PPT Slides Grade 10- 11students
chamm5
 
PPTX
Subprogramms
janapriyanaidu
 
PPTX
10.-Modular-Programming-with function and Sub Procedure.pptx
PurnaBahadurRana1
 
PPTX
Modular programming
bhuwanbist1
 
PPT
Visual Basic
mrsmackenzie
 
PPT
Visual Basic
mrsmackenzie
 
DOC
Chapter 5 notes new
HarshitParkar6677
 
PPTX
Functions and procedures
underwan
 
PDF
Unit iii vb_study_materials
gayaramesh
 
PPTX
Chap6 procedures & macros
HarshitParkar6677
 
DOC
Chapter 6 notes
HarshitParkar6677
 
Functions
Septi Ratnasari
 
Modular programming
BeebashPokhrel
 
9. DBMS Experiment Laboratory PresentationPPT
TheVerse1
 
Subroutines igcses computer science powerpoint
kireraruby
 
modularization-160202092213 (1).pdf
SreeramBaddila
 
SAP Modularization techniques
Jugul Crasta
 
Apple IIgs Programming (K Fest)
Polymorph
 
Modular programming in qbasic
Cavite National Science High School
 
Presentation of computer
SabinDhakal13
 
Problem Solving PPT Slides Grade 10- 11students
chamm5
 
Subprogramms
janapriyanaidu
 
10.-Modular-Programming-with function and Sub Procedure.pptx
PurnaBahadurRana1
 
Modular programming
bhuwanbist1
 
Visual Basic
mrsmackenzie
 
Visual Basic
mrsmackenzie
 
Chapter 5 notes new
HarshitParkar6677
 
Functions and procedures
underwan
 
Unit iii vb_study_materials
gayaramesh
 
Chap6 procedures & macros
HarshitParkar6677
 
Chapter 6 notes
HarshitParkar6677
 
Ad

More from Omar Al-Sabek (15)

PPTX
Google Big Table
Omar Al-Sabek
 
PDF
Online Certificate Data Mining with Weka
Omar Al-Sabek
 
PDF
Agile Methodology
Omar Al-Sabek
 
PPTX
E payment Project Demo
Omar Al-Sabek
 
PPTX
A petri-net
Omar Al-Sabek
 
PDF
Sets c1
Omar Al-Sabek
 
PDF
Records c2
Omar Al-Sabek
 
PPTX
Files c3
Omar Al-Sabek
 
PPTX
Files c4
Omar Al-Sabek
 
PDF
Pointers c5
Omar Al-Sabek
 
PDF
Stack c6
Omar Al-Sabek
 
PDF
Linked lists c7
Omar Al-Sabek
 
PDF
Double linked list c8
Omar Al-Sabek
 
PDF
Programming paradigms c1
Omar Al-Sabek
 
Google Big Table
Omar Al-Sabek
 
Online Certificate Data Mining with Weka
Omar Al-Sabek
 
Agile Methodology
Omar Al-Sabek
 
E payment Project Demo
Omar Al-Sabek
 
A petri-net
Omar Al-Sabek
 
Sets c1
Omar Al-Sabek
 
Records c2
Omar Al-Sabek
 
Files c3
Omar Al-Sabek
 
Files c4
Omar Al-Sabek
 
Pointers c5
Omar Al-Sabek
 
Stack c6
Omar Al-Sabek
 
Linked lists c7
Omar Al-Sabek
 
Double linked list c8
Omar Al-Sabek
 
Programming paradigms c1
Omar Al-Sabek
 

Recently uploaded (20)

PDF
0725.WHITEPAPER-UNIQUEWAYSOFPROTOTYPINGANDUXNOW.pdf
Thomas GIRARD, MA, CDP
 
PPTX
ASRB NET 2023 PREVIOUS YEAR QUESTION PAPER GENETICS AND PLANT BREEDING BY SAT...
Krashi Coaching
 
PDF
community health nursing question paper 2.pdf
Prince kumar
 
PDF
People & Earth's Ecosystem -Lesson 2: People & Population
marvinnbustamante1
 
PPSX
HEALTH ASSESSMENT (Community Health Nursing) - GNM 1st Year
Priyanshu Anand
 
PPTX
Stereochemistry-Optical Isomerism in organic compoundsptx
Tarannum Nadaf-Mansuri
 
PPTX
SPINA BIFIDA: NURSING MANAGEMENT .pptx
PRADEEP ABOTHU
 
PPTX
grade 5 lesson matatag ENGLISH 5_Q1_PPT_WEEK4.pptx
SireQuinn
 
PPTX
I AM MALALA The Girl Who Stood Up for Education and was Shot by the Taliban...
Beena E S
 
PDF
Biological Bilingual Glossary Hindi and English Medium
World of Wisdom
 
PPTX
PATIENT ASSIGNMENTS AND NURSING CARE RESPONSIBILITIES.pptx
PRADEEP ABOTHU
 
PDF
Isharyanti-2025-Cross Language Communication in Indonesian Language
Neny Isharyanti
 
PDF
The History of Phone Numbers in Stoke Newington by Billy Thomas
History of Stoke Newington
 
PPTX
STAFF DEVELOPMENT AND WELFARE: MANAGEMENT
PRADEEP ABOTHU
 
PDF
DIGESTION OF CARBOHYDRATES,PROTEINS,LIPIDS
raviralanaresh2
 
PPTX
MENINGITIS: NURSING MANAGEMENT, BACTERIAL MENINGITIS, VIRAL MENINGITIS.pptx
PRADEEP ABOTHU
 
PPTX
2025 Winter SWAYAM NPTEL & A Student.pptx
Utsav Yagnik
 
PDF
ARAL_Orientation_Day-2-Sessions_ARAL-Readung ARAL-Mathematics ARAL-Sciencev2.pdf
JoelVilloso1
 
PPTX
How to Create a PDF Report in Odoo 18 - Odoo Slides
Celine George
 
PPT
Talk on Critical Theory, Part One, Philosophy of Social Sciences
Soraj Hongladarom
 
0725.WHITEPAPER-UNIQUEWAYSOFPROTOTYPINGANDUXNOW.pdf
Thomas GIRARD, MA, CDP
 
ASRB NET 2023 PREVIOUS YEAR QUESTION PAPER GENETICS AND PLANT BREEDING BY SAT...
Krashi Coaching
 
community health nursing question paper 2.pdf
Prince kumar
 
People & Earth's Ecosystem -Lesson 2: People & Population
marvinnbustamante1
 
HEALTH ASSESSMENT (Community Health Nursing) - GNM 1st Year
Priyanshu Anand
 
Stereochemistry-Optical Isomerism in organic compoundsptx
Tarannum Nadaf-Mansuri
 
SPINA BIFIDA: NURSING MANAGEMENT .pptx
PRADEEP ABOTHU
 
grade 5 lesson matatag ENGLISH 5_Q1_PPT_WEEK4.pptx
SireQuinn
 
I AM MALALA The Girl Who Stood Up for Education and was Shot by the Taliban...
Beena E S
 
Biological Bilingual Glossary Hindi and English Medium
World of Wisdom
 
PATIENT ASSIGNMENTS AND NURSING CARE RESPONSIBILITIES.pptx
PRADEEP ABOTHU
 
Isharyanti-2025-Cross Language Communication in Indonesian Language
Neny Isharyanti
 
The History of Phone Numbers in Stoke Newington by Billy Thomas
History of Stoke Newington
 
STAFF DEVELOPMENT AND WELFARE: MANAGEMENT
PRADEEP ABOTHU
 
DIGESTION OF CARBOHYDRATES,PROTEINS,LIPIDS
raviralanaresh2
 
MENINGITIS: NURSING MANAGEMENT, BACTERIAL MENINGITIS, VIRAL MENINGITIS.pptx
PRADEEP ABOTHU
 
2025 Winter SWAYAM NPTEL & A Student.pptx
Utsav Yagnik
 
ARAL_Orientation_Day-2-Sessions_ARAL-Readung ARAL-Mathematics ARAL-Sciencev2.pdf
JoelVilloso1
 
How to Create a PDF Report in Odoo 18 - Odoo Slides
Celine George
 
Talk on Critical Theory, Part One, Philosophy of Social Sciences
Soraj Hongladarom
 

Function procedure c6 c7

  • 1. Pascal Programming Language Omar ElSabek & Fayez Ghazzawi IT Engineering 3th year – UNKNOWN Department
  • 2. •Quiet!!!!!!!!!! •Pay the fine! :P :D •Being late! •Talking!
  • 3. •Procedures and Functions • The most important material • which are very important and you should keep on practicing more often.
  • 4. • Pascal provides two kinds of subprograms: •Functions : these subprograms return a single value. •Procedures : these subprograms do not return a value directly.
  • 5. •Proceduresare just like small programs. • Sometimes they are called sub--programs.They help the programmer to avoid repetitions. • A procedure start off with a begin and ends up with an end;. • It can also have its own variables, which cannot be used with the main-program. Procedure Procedure name( Var Variable Name : Type );
  • 6. Program Lesson1_Program1 (input,output); Var Procedure Square(X : Integer; Var y : Integer); var Begin ………… End; Begin …………. End.
  • 8. There is aTwo type of Variables : Global Variables : That which we define in ProgramVar Local Variable : ThatWhich we define inside of our procedure/function or in procedure/function signature
  • 9. What is the signature !!!
  • 10. What is the signature !!! Procedure Procedure name( Var Variable Name : Type );Var Variable Name : Type
  • 11. What is the prototype {define} !!!
  • 12. What is the prototype !!! Procedure Procedure name( Var Variable Name : Type );
  • 13. Program Lesson1_Program1 (input,output); Var Z :integer ; Procedure Square(X : Integer; Var y : Integer); var moxo :real ; Begin ………… End; Begin …………. End.
  • 14. Program Lesson1_Program1 (input,output); Var Z :integer ; Procedure Square(X : Integer ; Var y : Integer); var moxo :real ; Begin ………… End; Begin …………. End. When you declare parameters to a procedure, variables must separated by a semi-colon ";".They are put in between the brackets, following the procedure name.
  • 15. Program Lesson1_Program1 (input,output); Var X , Z : integer ; Procedure Square(R : Integer ; Var Result : Integer); Begin Result := R * R ; End; Begin Readln(X); Square(X,Z); Writeln('The square of X is: '); Writeln( Z ); End.
  • 16. Program Lesson1_Program1 (input,output); Var X , Z : integer ; Procedure Square(R : Integer); Var Result : Integer; Begin Result := R * R ; writeln ('The square of X is: ' , Result); End; Begin Readln(X); Square(X); End.
  • 17. •Let’sTalk a little bit a bout our built in function !!
  • 18. • ABS( -5 ) 5 • Chr( 97 ) a • Ord( ‘ a ’ ) 97 • Sin(x) Cos(x) • Pred( 6 ) 5 • Sqr( 3 ) 9 • Sqrt( 9 ) 3 • Odd( 3 ) True • Even( 3 ) False • Succ ( 5 ) 6
  • 19. • Round( 3.14 ) 3 • Round( 3.64 ) 4
  • 20. •FunctionareThe second type of sub-program . • The only difference from the procedure is that the Function return a value at the end. • A Function start off with a begin and ends up with an end;. • It can also have its own variables, which cannot be used with the main-program. Function FunctionName(Var VariableName:Type): Return Type;
  • 21. Program Lesson1_Program1 (input,output); Var Function Square(X : Integer): Integer ; var Begin ………… End; Begin …………. End.
  • 22. Program Lesson1_Program1 (input,output); Var X , Z : integer ; Function Square(R : Integer) : Integer; Begin Square := R * R ; End; Begin Readln(X); Z:= Square(X); Writeln('The square of X is: '); Writeln( Z ); End.