+ All Categories
Home > Technology > Globalandlocal

Globalandlocal

Date post: 05-Dec-2014
Category:
Upload: jam-catipon
View: 411 times
Download: 0 times
Share this document with a friend
Description:
Notes sa computer :)
8
Global and Local Variables GAME: PUZZLE WHAT IS GLOBAL VARIABLE WHAT IS LOCAL VARIABLE quiz
Transcript
Page 1: Globalandlocal

Global and Local Variables

GAME:PUZZLE

WHAT IS GLOBAL

VARIABLE

WHAT IS LOCAL

VARIABLE

quiz

Page 2: Globalandlocal

Puzzle Game

GROUP 1 GROUP 2

Dacanay FernandezDongon ArnigoFlora BadeUy GarciaLopez Navaroza

Fuentes ArevaloGuillermo Dacquel

De Guzman IgnacioArenas MalagdayCrispino Manubag

Page 3: Globalandlocal

Puzzle Game

GROUP 1 GROUP 2

Bagabag BuendiaCatipon LampanoLining LopezSagun AggasidCuerdo LagrisolaAdarlo Antonio

Llao FrancoDealca Nunez

Macaspac RamirezValenzuela Mariano

Balderama DantesMabaet

Page 4: Globalandlocal

program Factorprog;Uses crt;Var No: integer;

Function Factor(N:integer): integer;Var

F,I: integer;BeginF:=1;For I:=N down to 1 doF:= F*I;Factor:=F;End;

BeginClrscr;Writeln(‘Enter a number:’);Readln(No);Writeln(‘The Factorial Value:’, Factor(No));Readln;End.

Page 5: Globalandlocal

Global Variable

are accessible from anywhere in the program

and retain their values until the document is unloaded.

Page 6: Globalandlocal

Local Variable

are created during functioncalls for temporary use and are accessible only within

the functions that create them.

Page 7: Globalandlocal

program Factorprog;Uses crt;Var Base, Expo: integer;Function Power (B: integer; E: integer) : integer;Var P: integer; I: integer;BeginP:= 1;I:= E;RepeatP:=P*BI:= I-1;Until (I=0);Power:=P;End;

BeginClrscr;Writeln(‘Enter base number:’);Readln(Base);writeln(‘Enter exponent number:’);Readln(Expo);Writeln(‘Power Value:’, Power(Base, Expo));Readln;End.

Page 8: Globalandlocal

Recommended