COMPUTER SCIENCES II Spring Term 2017 Asst.Prof.Elgin KILIÇ

Size: px
Start display at page:

Download "COMPUTER SCIENCES II Spring Term 2017 Asst.Prof.Elgin KILIÇ"

Transcription

1 COMPUTER SCIENCES II Spring Term 2017 Asst.Prof.Elgin KILIÇ TURBO PASCAL WEEK 2

2 DECLARATION BLOCKS in DETAIL Uses There default sub pascal programs called UNITS which are already embedded in pascal editor. To access these USES block is used to run these on editor of pascal. Generally it is given in first line after name of program. UNITS can not run (process) by themselves. They must be called by a program.

3 Example for Uses BLOCK CLRSCR = Clear Screen = This is used to clear the screen it is a reserved command of PASCAL itself. Uses crt;.. Begin {main program block} Clrscr;.. end. 3

4 Label BloCK In any program each expression is separated by ; from other expressions. PROGRAM FLOW is from TOP to BOTTOM. If there is a need to change the flow of the program, then the place where we want the program to flow must be declared. To do this we need LABEL to address or declare this flow place. GOTO command is used to change flow. LABEL names are defined like variables. Variable definition rules are also valid for label defining. Label etiket1,etiket 2;

5 Type BloCK This block is used to define USER DEFINED TYPES. Any programmer can define new types by using default types of PASCAL. Type name of the type that user defined=type style; Example: type St20=string[20]; var a:st20;

6 OPERATORS 1)Aritmetic operators 2) Relational Operators 3) Logical Operators

7 Assignment operator Assign a value to a variable <name of variable>:=<value of variable>; A:=6; expression1:=expression2 OPERATOR expression3; A:=A+1; A:=A*B; If there are same variables in both sides of a equality ; then values of these variables are NOT EQUAL.

8 we can use logic operators in relational expressions: 0<=x<=34 X is an element in interval [0,34] (x>=0) AND (x<=34)

9 OPERATORS in DETAIL 1)Aritmetic operators + addition - subtraction * multiplicaiton / division 2) Relational Operators < less than > Greater than <= Less than or equal >= greater than or equal <> Not equal = equal 3) Logical Operators NOT değil OR veya AND ve Ex: (A<B) AND (C<=8) (A>(C-4)) OR (C<(NOT(B)))

10 mod operator (operand1) mod ( operand2) Gives an integer result of remainder after dividing OPERAND1 by OPERAND2. 3mod5=3 11mod4=3 22mod6=4 (- 13)mod5=2

11 div operator (operand1) div ( operand2) Gives an integer result of after dividing OPERAND1 by OPERAND2. It is used for exact division. 4div13=0 18div5=3 16div(-3)=-5

12 Priority order in Arithmetic Operations Parenthesis operator ( ) Arithmetic functions(e,ln ) Power DIVISION multiplication div OPERATOR of PASCAL mod OPERATOR of PASCAL ADDITION SUBTRACTION RELATIONAL expressions(<,>, ) LOGICAL expressions

13 INPUT OUTPUT EXPRESSIONS INPUT (READ) EXPRESSION: General usage: Read(variable1,variable2,,variablen); (READLN) EXPRESSION: (readln=readline) After getting input computer sends the cursor to the beginning of next line General usage: Readln(variable1,variable2,,variablen);

14 Difference between read and readln Program source code Var a, b:integer; c: real; Screen Result 12,35,-264 CURSOR WAITS HERE begin read (a,b,c); End. Var a, b:integer; c: real; 12,35,-264 CURSOR WAITS HERE in NEW LINE begin readln(a,b,c); end.

15 Char Type INPUT expressions char type variables allow users to enter ONE CHARACTER. If there are more than one character type variable SPACE shouldn t be given between these characters. Var a, b: char; begin read(a); read(b); End. ZX we press ENTER after Z X???? Computer takes Z as input not X. When we enter word ELGIN for b it can only process E.

16 STRING TYPE INPUT expressions Var a, b:string[20]; begin read(a,b); End. a and b CAN CONTAIN 20 CHARACTERS AT MOST. SO THEY TAKE MUCH SPACE FROM MEMORY. Var a, b:string[20]; begin A:= Ege University ; B:= mathematics Department ; Writeln(a); Writeln(b); End. We can assign initial (başlangıç) values to string type variables.

17 OUTPUT EXPRESSION 1 These are expressions that show output values on SCREEN of computer *write deyimi: General usage; Write(varibale1,variable2,,variablen); CURSOR waits on screen after showing the values in this command. It waits at right side of output expression. Var a, b: byte; top: integer; begin read(a,b); top:=a+b; write(top); end.

18 OUTPUT EXPRESSION 2 Instead of values of variables if anyone wants to give some information must be used. Write( Information about some data in program ); CURSOR waits on screen after showing the values in this command. It waits at right side of output expression. Program source code Var a, b: byte; Output after run process This is our first program. begin write( This is our first program. ); end.

19 1 Example OUTPUT EXPRESSION Program source code Output after run process Var a, b: byte; begin A:=5; B:=7; write( This is our first program. ); Write( A=,A); Write( B=,B); end. This is our first program.a=5 B=7 Cursor waits

20 2Example OUTPUT EXPRESSION Program source code Var a, b: byte; begin A:=5; B:=7; writeln( This is our first program. ); Writeln( A=,A); Writeln( B=,B); Writeln( A and B are=,a,b ); Writeln(a,b); end. Output after run process This is our first program. A=5 B=7 Cursor waits here. A and B are=,a,b 57

21 3Example OUTPUT EXPRESSION Program source code Var a,b: byte; sum: integer; begin write( Enter 1. number ); readln(a); write( Enter 2. number ); readln(b); sum:=(a+b); writeln( result=,sum); end. Output after run process Enter 1. number 25 Enter 2. number 73 result=98 Cursor waits here.

22 Example: Write a Pascal Program which gives the following output. First Number=5 Second Number= MULT=firstnumber*secondnumber=5*8=40 Program run process stopped

23 Example: Write a Pascal Program which gives the following output. Var a,b,top: integer; Begin a:=5;b:=8; Write( First number=,a); Write( Second number=,b); Writeln( Mult=firstnumber*secondnumber=,a*b); Write( Program runprocess stopped. ); End.

24 Program p1; Uses crt; BEGIN write( Ege University ); Write( Faculty of Science ); Write( Department of Maths ); Write( Computer Sciences II course ); Readln; END.

25 Program p1; Uses crt; BEGIN writeln( Ege University ); Writeln( Faculty of Science ); Writeln( Department of Maths ); Writeln( Computer Sciences II course ); Readln; END.

26 Program p2; Uses crt; Var a,b:integer; BEGIN clrscr; a:=5; b:=7; Writeln( a+b is, a+b); Writeln(a, +,b, =, a+b); Writeln( a*b is, a*b); Writeln(a, *,b, =, a*b); Readln; END.

27 Program p3; Uses crt; Var a,b,sum,mult:integer; BEGIN clrscr; Writeln( Enter first number= ); readln(a); Writeln( Enter second number= ); readln(b); sum:=a+b; Writeln( Sum of, a, and,b, is, sum); mult:=a*b; Writeln( Multiplication of, a, and,b, is, mult); Readln; END.

28 Program p4; Uses crt; Var a,b:char; BEGIN clrscr; Writeln( Enter first name= ); readln(a); Writeln( Enter surname= ); readln(b); Writeln( The first charcter is =, a); Writeln( The second charcter is =, b); Readln; END.

29 Program p5; Uses crt; Var a,b:string[5]; BEGIN clrscr; Write( Enter first name= ); readln(a); Write( Enter surname= ); readln(b); Writeln( first name is =, a); Writeln( surname is =, b); Readln; END.

30 Program p5; Uses crt; Var a:string[10]; b:string[20]; BEGIN clrscr; Write( Enter first name= ); readln(a); Write( Enter surname= ); readln(b); Writeln( first name is =, a); Writeln( surname is =, b); Readln; END.

Unit 2: Accentuate the Negative Name:

Unit 2: Accentuate the Negative Name: Unit 2: Accentuate the Negative Name: 1.1 Using Positive & Negative Numbers Number Sentence A mathematical statement that gives the relationship between two expressions that are composed of numbers and

More information

Computer Science II TURBO PASCAL

Computer Science II TURBO PASCAL Computer Science II TURBO PASCAL WEEK4 Program Flow Commands Dr.ELGİN KILIÇ IF THEN ELSE expression: If then Begin End else Begin < Processes when CASE is FALSE> End;

More information

A/L 2011_revision. PASCAL PROGRAMMING

A/L 2011_revision. PASCAL PROGRAMMING Pascal is a high level programming language developed by Niklaus Wirth in 1970 based on the ALGOL programming language. It was named in honor of the French mathematician and philosopher Blaise Pascal.

More information

Basic operators, Arithmetic, Relational, Bitwise, Logical, Assignment, Conditional operators. JAVA Standard Edition

Basic operators, Arithmetic, Relational, Bitwise, Logical, Assignment, Conditional operators. JAVA Standard Edition Basic operators, Arithmetic, Relational, Bitwise, Logical, Assignment, Conditional operators JAVA Standard Edition Java - Basic Operators Java provides a rich set of operators to manipulate variables.

More information

Computer Programming CS F111

Computer Programming CS F111 Computer Programming CS F111 BITS Pilani Dubai Campus NAND KUMAR Basics of C Programming BITS Pilani Dubai Campus Write a program that 1. Asks 5 marks from the user, find the average of the marks and print

More information

Class 2: Variables and Memory. Laura Marik Spring 2012 C++ Course Notes (Provided by Jason Minski)

Class 2: Variables and Memory. Laura Marik Spring 2012 C++ Course Notes (Provided by Jason Minski) Class 2: Variables and Memory Variables A variable is a value that is stored in memory It can be numeric or a character C++ needs to be told what type it is before it can store it in memory It also needs

More information

Fundamentals of Programming CS-110. Lecture 3

Fundamentals of Programming CS-110. Lecture 3 Fundamentals of Programming CS-110 Lecture 3 Operators Operators Operators are words or symbols that cause a program to do something to variables. OPERATOR TYPES: Type Operators Usage Arithmetic + - *

More information

UNIT 3 OPERATORS. [Marks- 12]

UNIT 3 OPERATORS. [Marks- 12] 1 UNIT 3 OPERATORS [Marks- 12] SYLLABUS 2 INTRODUCTION C supports a rich set of operators such as +, -, *,,

More information

Computer Science II TURBO PASCAL

Computer Science II TURBO PASCAL Computer Science II TURBO PASCAL WEEK6 LOOP structures Dr.ELGİN KILIÇ Loop Type Description while-do loop Repeats a statement or group of statements while a given condition is true. It tests the condition

More information

x= suppose we want to calculate these large values 1) x= ) x= ) x=3 100 * ) x= ) 7) x=100!

x= suppose we want to calculate these large values 1) x= ) x= ) x=3 100 * ) x= ) 7) x=100! HighPower large integer calculator intended to investigate the properties of large numbers such as large exponentials and factorials. This application is written in Delphi 7 and can be easily ported to

More information

Getting Started With Pascal Programming

Getting Started With Pascal Programming Getting Started With Pascal Programming How are computer programs created What is the basic structure of a Pascal Program Variables and constants Input and output Pascal operators Common programming errors

More information

9/10/10. Arithmetic Operators. Today. Assigning floats to ints. Arithmetic Operators & Expressions. What do you think is the output?

9/10/10. Arithmetic Operators. Today. Assigning floats to ints. Arithmetic Operators & Expressions. What do you think is the output? Arithmetic Operators Section 2.15 & 3.2 p 60-63, 81-89 1 Today Arithmetic Operators & Expressions o Computation o Precedence o Associativity o Algebra vs C++ o Exponents 2 Assigning floats to ints int

More information

The assignments. DAB721 Computer Architecture. Today. PPM and PGM. PPM and PGM. The deal. Parallel programming. Image manipulation

The assignments. DAB721 Computer Architecture. Today. PPM and PGM. PPM and PGM. The deal. Parallel programming. Image manipulation The assignments DAB721 Computer Architecture Introduction to ZPL Morgan Ericsson Parallel programming ZPL (today) MPI (later) Image manipulation Greyscale conversion Histogram Smoothing Today Introduction

More information

In Delphi script, when values are assigned to variables, the colon-equal operator is used; :=

In Delphi script, when values are assigned to variables, the colon-equal operator is used; := Statements and Operators Old Content - visit altium.com/documentation Modified by on 13-Sep-2017 Parent page: DelphiScript DelphiScript Statements A statement in DelphiScript is considered as simple when

More information

A First Program - Greeting.cpp

A First Program - Greeting.cpp C++ Basics A First Program - Greeting.cpp Preprocessor directives Function named main() indicates start of program // Program: Display greetings #include using namespace std; int main() { cout

More information

Operators in java Operator operands.

Operators in java Operator operands. Operators in java Operator in java is a symbol that is used to perform operations and the objects of operation are referred as operands. There are many types of operators in java such as unary operator,

More information

Flow Chart. The diagrammatic representation shows a solution to a given problem.

Flow Chart. The diagrammatic representation shows a solution to a given problem. low Charts low Chart A flowchart is a type of diagram that represents an algorithm or process, showing the steps as various symbols, and their order by connecting them with arrows. he diagrammatic representation

More information

ISA 563 : Fundamentals of Systems Programming

ISA 563 : Fundamentals of Systems Programming ISA 563 : Fundamentals of Systems Programming Variables, Primitive Types, Operators, and Expressions September 4 th 2008 Outline Define Expressions Discuss how to represent data in a program variable name

More information

Informatics Ingeniería en Electrónica y Automática Industrial

Informatics Ingeniería en Electrónica y Automática Industrial Informatics Ingeniería en Electrónica y Automática Industrial Operators and expressions in C Operators and expressions in C Numerical expressions and operators Arithmetical operators Relational and logical

More information

Operators in C. Staff Incharge: S.Sasirekha

Operators in C. Staff Incharge: S.Sasirekha Operators in C Staff Incharge: S.Sasirekha Operators An operator is a symbol which helps the user to command the computer to do a certain mathematical or logical manipulations. Operators are used in C

More information

CIS 110: Introduction to Computer Programming

CIS 110: Introduction to Computer Programming CIS 110: Introduction to Computer Programming Lecture 3 Express Yourself ( 2.1) 9/16/2011 CIS 110 (11fa) - University of Pennsylvania 1 Outline 1. Data representation and types 2. Expressions 9/16/2011

More information

Operators and Expressions:

Operators and Expressions: Operators and Expressions: Operators and expression using numeric and relational operators, mixed operands, type conversion, logical operators, bit operations, assignment operator, operator precedence

More information

Programming Fundamentals (CS 302 ) Dr. Ihsan Ullah. Lecturer Department of Computer Science & IT University of Balochistan

Programming Fundamentals (CS 302 ) Dr. Ihsan Ullah. Lecturer Department of Computer Science & IT University of Balochistan Programming Fundamentals (CS 302 ) Dr. Ihsan Ullah Lecturer Department of Computer Science & IT University of Balochistan 1 Outline p Introduction p Program development p C language and beginning with

More information

Chapter Two MIPS Arithmetic

Chapter Two MIPS Arithmetic Chapter Two MIPS Arithmetic Computer Organization Review Binary Representation Used for all data and instructions Fixed size values: 8, 16, 32, 64 Hexadecimal Sign extension Base and virtual machines.

More information

Prepared by: Shraddha Modi

Prepared by: Shraddha Modi Prepared by: Shraddha Modi Introduction Operator: An operator is a symbol that tells the Computer to perform certain mathematical or logical manipulations. Expression: An expression is a sequence of operands

More information

DEPARTMENT OF MATHS, MJ COLLEGE

DEPARTMENT OF MATHS, MJ COLLEGE T. Y. B.Sc. Mathematics MTH- 356 (A) : Programming in C Unit 1 : Basic Concepts Syllabus : Introduction, Character set, C token, Keywords, Constants, Variables, Data types, Symbolic constants, Over flow,

More information

Introduction. Following are the types of operators: Unary requires a single operand Binary requires two operands Ternary requires three operands

Introduction. Following are the types of operators: Unary requires a single operand Binary requires two operands Ternary requires three operands Introduction Operators are the symbols which operates on value or a variable. It tells the compiler to perform certain mathematical or logical manipulations. Can be of following categories: Unary requires

More information

Beginning Programming (Pascal) Lecture 75. Figure 1. type-declarations. simple-type. pointer-type. array-type. file-type. set-type.

Beginning Programming (Pascal) Lecture 75. Figure 1. type-declarations. simple-type. pointer-type. array-type. file-type. set-type. -declarations -identifier = ; ; Figure 1. -declarations simple- pointer- array- file- set- record- Figure 2. simple- standard- subrange- enumerated- Figure 3. simple- standard- boolean char integer real

More information

Character Set. The character set of C represents alphabet, digit or any symbol used to represent information. Digits 0, 1, 2, 3, 9

Character Set. The character set of C represents alphabet, digit or any symbol used to represent information. Digits 0, 1, 2, 3, 9 Character Set The character set of C represents alphabet, digit or any symbol used to represent information. Types Uppercase Alphabets Lowercase Alphabets Character Set A, B, C, Y, Z a, b, c, y, z Digits

More information

Chapter 2: Using Data

Chapter 2: Using Data Chapter 2: Using Data TRUE/FALSE 1. A variable can hold more than one value at a time. F PTS: 1 REF: 52 2. The legal integer values are -2 31 through 2 31-1. These are the highest and lowest values that

More information

Computer (Literacy) Skills. Variables, records, and pointers. Lubomír Bulej KDSS MFF UK

Computer (Literacy) Skills. Variables, records, and pointers. Lubomír Bulej KDSS MFF UK Computer (Literacy) Skills Variables, records, and pointers Lubomír Bulej KDSS MFF UK Variable = named storage location Values stored as sequences of bytes Type determines storage size and layout Also

More information

Quick Reference Guide

Quick Reference Guide SOFTWARE AND HARDWARE SOLUTIONS FOR THE EMBEDDED WORLD mikroelektronika Development tools - Books - Compilers Quick Reference Quick Reference Guide with EXAMPLES for Pascal language This reference guide

More information

JAVA OPERATORS GENERAL

JAVA OPERATORS GENERAL JAVA OPERATORS GENERAL Java provides a rich set of operators to manipulate variables. We can divide all the Java operators into the following groups: Arithmetic Operators Relational Operators Bitwise Operators

More information

Some Applications of Stack. Spring Semester 2007 Programming and Data Structure 1

Some Applications of Stack. Spring Semester 2007 Programming and Data Structure 1 Some Applications of Stack Spring Semester 2007 Programming and Data Structure 1 Arithmetic Expressions Polish Notation Spring Semester 2007 Programming and Data Structure 2 What is Polish Notation? Conventionally,

More information

Lesson #3. Variables, Operators, and Expressions. 3. Variables, Operators and Expressions - Copyright Denis Hamelin - Ryerson University

Lesson #3. Variables, Operators, and Expressions. 3. Variables, Operators and Expressions - Copyright Denis Hamelin - Ryerson University Lesson #3 Variables, Operators, and Expressions Variables We already know the three main types of variables in C: int, char, and double. There is also the float type which is similar to double with only

More information

Information Science 1

Information Science 1 Topics covered Information Science 1 Terms and concepts from Week 8 Simple calculations Documenting programs Simple Calcula,ons Expressions Arithmetic operators and arithmetic operator precedence Mixed-type

More information

Programming in C++ 5. Integral data types

Programming in C++ 5. Integral data types Programming in C++ 5. Integral data types! Introduction! Type int! Integer multiplication & division! Increment & decrement operators! Associativity & precedence of operators! Some common operators! Long

More information

Operators & Expressions

Operators & Expressions Operators & Expressions Operator An operator is a symbol used to indicate a specific operation on variables in a program. Example : symbol + is an add operator that adds two data items called operands.

More information

Relational and Logical Operators

Relational and Logical Operators Relational and Logical Operators Relational Operators Relational operators are used to represent conditions (such as space 0 in the water tank example) Result of the condition is either true or false In

More information

Department of Computer Science

Department of Computer Science Department of Computer Science Definition An operator is a symbol (+,-,*,/) that directs the computer to perform certain mathematical or logical manipulations and is usually used to manipulate data and

More information

Constructing Algorithms and Pseudocoding This document was originally developed by Professor John P. Russo

Constructing Algorithms and Pseudocoding This document was originally developed by Professor John P. Russo Constructing Algorithms and Pseudocoding This document was originally developed by Professor John P. Russo Purpose: # Describe the method for constructing algorithms. # Describe an informal language for

More information

Introduction to C# Applications

Introduction to C# Applications 1 2 3 Introduction to C# Applications OBJECTIVES To write simple C# applications To write statements that input and output data to the screen. To declare and use data of various types. To write decision-making

More information

Information Science 1

Information Science 1 Information Science 1 Simple Calcula,ons Week 09 College of Information Science and Engineering Ritsumeikan University Topics covered l Terms and concepts from Week 8 l Simple calculations Documenting

More information

Making Decisions In Pascal

Making Decisions In Pascal Making Decisions In Pascal In this section of notes you will learn how to have your Pascal programs choose between alternative courses of action High Level View Of Decision Making For The Computer Is income

More information

C Programming Multiple. Choice

C Programming Multiple. Choice C Programming Multiple Choice Questions 1.) Developer of C language is. a.) Dennis Richie c.) Bill Gates b.) Ken Thompson d.) Peter Norton 2.) C language developed in. a.) 1970 c.) 1976 b.) 1972 d.) 1980

More information

C: How to Program. Week /Mar/05

C: How to Program. Week /Mar/05 1 C: How to Program Week 2 2007/Mar/05 Chapter 2 - Introduction to C Programming 2 Outline 2.1 Introduction 2.2 A Simple C Program: Printing a Line of Text 2.3 Another Simple C Program: Adding Two Integers

More information

This tutorial will teach you about operators. Operators are symbols that are used to represent an actions used in programming.

This tutorial will teach you about operators. Operators are symbols that are used to represent an actions used in programming. OPERATORS This tutorial will teach you about operators. s are symbols that are used to represent an actions used in programming. Here is the link to the tutorial on TouchDevelop: http://tdev.ly/qwausldq

More information

Will introduce various operators supported by C language Identify supported operations Present some of terms characterizing operators

Will introduce various operators supported by C language Identify supported operations Present some of terms characterizing operators Operators Overview Will introduce various operators supported by C language Identify supported operations Present some of terms characterizing operators Operands and Operators Mathematical or logical relationships

More information

2. Distinguish between a unary, a binary and a ternary operator. Give examples of C++ operators for each one of them.

2. Distinguish between a unary, a binary and a ternary operator. Give examples of C++ operators for each one of them. 1. Why do you think C++ was not named ++C? C++ is a super set of language C. All the basic features of C are used in C++ in their original form C++ can be described as C+ some additional features. Therefore,

More information

GO - OPERATORS. This tutorial will explain the arithmetic, relational, logical, bitwise, assignment and other operators one by one.

GO - OPERATORS. This tutorial will explain the arithmetic, relational, logical, bitwise, assignment and other operators one by one. http://www.tutorialspoint.com/go/go_operators.htm GO - OPERATORS Copyright tutorialspoint.com An operator is a symbol that tells the compiler to perform specific mathematical or logical manipulations.

More information

Object Oriented Programming Using C++ Mathematics & Computing IET, Katunayake

Object Oriented Programming Using C++ Mathematics & Computing IET, Katunayake Assigning Values // Example 2.3(Mathematical operations in C++) float a; cout > a; cout

More information

Unit-2 (Operators) ANAND KR.SRIVASTAVA

Unit-2 (Operators) ANAND KR.SRIVASTAVA Unit-2 (Operators) ANAND KR.SRIVASTAVA 1 Operators in C ( use of operators in C ) Operators are the symbol, to perform some operation ( calculation, manipulation). Set of Operations are used in completion

More information

1.8 Intro to Variables, Algebraic Expressions, and Equations

1.8 Intro to Variables, Algebraic Expressions, and Equations 1.8 Intro to Variables, Algebraic Expressions, and Equations Professor Tim Busken M.S. Applied Mathematics with a Concentration in Dynamical Systems San Diego State University 2011 Southwestern College

More information

Computational Physics Operating systems

Computational Physics Operating systems Computational Physics numerical methods with C++ (and UNIX) 2018-19 Fernando Barao Instituto Superior Tecnico, Dep. Fisica email: fernando.barao@tecnico.ulisboa.pt Computational Physics 2018-19 (Phys Dep

More information

Chapter 2: Data and Expressions

Chapter 2: Data and Expressions Chapter 2: Data and Expressions CS 121 Department of Computer Science College of Engineering Boise State University January 15, 2015 Chapter 2: Data and Expressions CS 121 1 / 1 Chapter 2 Part 1: Data

More information

A complex expression to evaluate we need to reduce it to a series of simple expressions. E.g * 7 =>2+ 35 => 37. E.g.

A complex expression to evaluate we need to reduce it to a series of simple expressions. E.g * 7 =>2+ 35 => 37. E.g. 1.3a Expressions Expressions An Expression is a sequence of operands and operators that reduces to a single value. An operator is a syntactical token that requires an action be taken An operand is an object

More information

Data Types and Variables in C language

Data Types and Variables in C language Data Types and Variables in C language Disclaimer The slides are prepared from various sources. The purpose of the slides is for academic use only Operators in C C supports a rich set of operators. Operators

More information

Computer Architecture and System Software Lecture 02: Overview of Computer Systems & Start of Chapter 2

Computer Architecture and System Software Lecture 02: Overview of Computer Systems & Start of Chapter 2 Computer Architecture and System Software Lecture 02: Overview of Computer Systems & Start of Chapter 2 Instructor: Rob Bergen Applied Computer Science University of Winnipeg Announcements Website is up

More information

Operators and Expressions in C & C++ Mahesh Jangid Assistant Professor Manipal University, Jaipur

Operators and Expressions in C & C++ Mahesh Jangid Assistant Professor Manipal University, Jaipur Operators and Expressions in C & C++ Mahesh Jangid Assistant Professor Manipal University, Jaipur Operators and Expressions 8/24/2012 Dept of CS&E 2 Arithmetic operators Relational operators Logical operators

More information

Annex A (Informative) Collected syntax The nonterminal symbols pointer-type, program, signed-number, simple-type, special-symbol, and structured-type

Annex A (Informative) Collected syntax The nonterminal symbols pointer-type, program, signed-number, simple-type, special-symbol, and structured-type Pascal ISO 7185:1990 This online copy of the unextended Pascal standard is provided only as an aid to standardization. In the case of dierences between this online version and the printed version, the

More information

Getting Started With Pascal Programming

Getting Started With Pascal Programming Getting Started With Pascal Programming How are computer programs created What is the basic structure of a Pascal Program Variables and constants Input and output Common programming errors Computer Programs

More information

Arithmetic for Computers

Arithmetic for Computers MIPS Arithmetic Instructions Cptr280 Dr Curtis Nelson Arithmetic for Computers Operations on integers Addition and subtraction; Multiplication and division; Dealing with overflow; Signed vs. unsigned numbers.

More information

ARITHMETIC EXPRESSION

ARITHMETIC EXPRESSION Section 1: Expression & Terms MATH LEVEL 2 LESSON PLAN 1 ARITHMETIC EXPRESSION 2017 Copyright Vinay Agarwala, Revised: 10/31/17 1. An arithmetic expression is made up of numbers joined by addition (+),

More information

CS Programming I: Primitives and Expressions

CS Programming I: Primitives and Expressions CS 200 - Programming I: Primitives and Expressions Marc Renault Department of Computer Sciences University of Wisconsin Madison Spring 2018 TopHat Sec 3 (AM) Join Code: 427811 TopHat Sec 4 (PM) Join Code:

More information

ADD Identifier-1 TO Identifier-2 Literal-1. ADD Identifier-1. GIVING Identifier-2 Literal-1

ADD Identifier-1 TO Identifier-2 Literal-1. ADD Identifier-1. GIVING Identifier-2 Literal-1 The Basic Arithmetic Verbs All basic arithmetic operations of ADD, SUBTRACT, MULTIPLY, and DIVIDE require the fields operated on :- 1) Have numeric PICTURE clause 2) Actually have numeric data when the

More information

Today s Topics. Team Project Introduce this year s team project. S/SL S/SL, the Syntax/Semantic Language. CISC 458 Winter J.R.

Today s Topics. Team Project Introduce this year s team project. S/SL S/SL, the Syntax/Semantic Language. CISC 458 Winter J.R. Today s Topics Team Project Introduce this year s team project S/SL S/SL, the Syntax/Semantic Language Team Project CISC / CMPE 458 - Project 2019 Implement a compiler for a new language called Mini-Turing

More information

Sir Syed University of Engineering and Technology. Computer Programming & Problem Solving ( CPPS )

Sir Syed University of Engineering and Technology. Computer Programming & Problem Solving ( CPPS ) Computer Programming & Problem Solving ( CPPS ) Chapter No 2 Sir Syed University of Engineering & Technology Computer Engineering Department University Road, Karachi-75300, PAKISTAN Muzammil Ahmad Khan

More information

1 Elementary number theory

1 Elementary number theory Math 215 - Introduction to Advanced Mathematics Spring 2019 1 Elementary number theory We assume the existence of the natural numbers and the integers N = {1, 2, 3,...} Z = {..., 3, 2, 1, 0, 1, 2, 3,...},

More information

Math & CompSci Contest - model Written Test in Computer Science

Math & CompSci Contest - model Written Test in Computer Science BABEŞ-BOLYAI UNIVERSITY FACULTY OF MATHEMATICS AND COMPUTER SCIENCE Important observations for candidates: Math & CompSci Contest - model Written Test in Computer Science 1. All arrays are indexed starting

More information

Quick Reference Guide

Quick Reference Guide SOFTWARE AND HARDWARE SOLUTIONS FOR THE EMBEDDED WORLD mikroelektronika Development tools - Books - Compilers Quick Reference Quick Reference Guide with EXAMPLES for Basic language This reference guide

More information

I Internal Examination Sept Class: - BCA I Subject: - Principles of Programming Lang. (BCA 104) MM: 40 Set: A Time: 1 ½ Hrs.

I Internal Examination Sept Class: - BCA I Subject: - Principles of Programming Lang. (BCA 104) MM: 40 Set: A Time: 1 ½ Hrs. I Internal Examination Sept. 2018 Class: - BCA I Subject: - Principles of Programming Lang. (BCA 104) MM: 40 Set: A Time: 1 ½ Hrs. [I]Very short answer questions (Max 40 words). (5 * 2 = 10) 1. What is

More information

Data Handing in Python

Data Handing in Python Data Handing in Python As per CBSE curriculum Class 11 Chapter- 3 By- Neha Tyagi PGT (CS) KV 5 Jaipur(II Shift) Jaipur Region Introduction In this chapter we will learn data types, variables, operators

More information

Arithmetic and Bitwise Operations on Binary Data

Arithmetic and Bitwise Operations on Binary Data Arithmetic and Bitwise Operations on Binary Data CSCI 2400: Computer Architecture ECE 3217: Computer Architecture and Organization Instructor: David Ferry Slides adapted from Bryant & O Hallaron s slides

More information

Chapter 2 Using Data. Instructor s Manual Table of Contents. At a Glance. Overview. Objectives. Teaching Tips. Quick Quizzes. Class Discussion Topics

Chapter 2 Using Data. Instructor s Manual Table of Contents. At a Glance. Overview. Objectives. Teaching Tips. Quick Quizzes. Class Discussion Topics Java Programming, Sixth Edition 2-1 Chapter 2 Using Data At a Glance Instructor s Manual Table of Contents Overview Objectives Teaching Tips Quick Quizzes Class Discussion Topics Additional Projects Additional

More information

Learning the Language - V

Learning the Language - V Learning the Language - V Fundamentals We now have locations to store things so we need a way to get things into those storage locations To do that, we use assignment statements Deja Moo: The feeling that

More information

Lesson 1: Arithmetic Review

Lesson 1: Arithmetic Review Lesson 1: Arithmetic Review Topics and Objectives: Order of Operations Fractions o Improper fractions and mixed numbers o Equivalent fractions o Fractions in simplest form o One and zero Operations on

More information

CT 229. Java Syntax 26/09/2006 CT229

CT 229. Java Syntax 26/09/2006 CT229 CT 229 Java Syntax 26/09/2006 CT229 Lab Assignments Assignment Due Date: Oct 1 st Before submission make sure that the name of each.java file matches the name given in the assignment sheet!!!! Remember:

More information

C++ is case sensitive language, meaning that the variable first_value, First_Value or FIRST_VALUE will be treated as different.

C++ is case sensitive language, meaning that the variable first_value, First_Value or FIRST_VALUE will be treated as different. C++ Character Set a-z, A-Z, 0-9, and underscore ( _ ) C++ is case sensitive language, meaning that the variable first_value, First_Value or FIRST_VALUE will be treated as different. Identifier and Keywords:

More information

Operators. Lecture 3 COP 3014 Spring January 16, 2018

Operators. Lecture 3 COP 3014 Spring January 16, 2018 Operators Lecture 3 COP 3014 Spring 2018 January 16, 2018 Operators Special built-in symbols that have functionality, and work on operands operand an input to an operator Arity - how many operands an operator

More information

Expressions and Statementst t. Assignment Operator. C Programming Lecture 6 : Operators. Expression

Expressions and Statementst t. Assignment Operator. C Programming Lecture 6 : Operators. Expression Expressions and Statementst t Expression C Programming Lecture 6 : Operators Combination of constants,variables,operators, operators and function calls a+b 3.0*x 9.66553 tan(angle) Statement An expression

More information

Computer Programming : C++

Computer Programming : C++ The Islamic University of Gaza Engineering Faculty Department of Computer Engineering Fall 2017 ECOM 2003 Muath i.alnabris Computer Programming : C++ Experiment #1 Basics Contents Structure of a program

More information

Modular Arithmetic. Marizza Bailey. December 14, 2015

Modular Arithmetic. Marizza Bailey. December 14, 2015 Modular Arithmetic Marizza Bailey December 14, 2015 Introduction to Modular Arithmetic If someone asks you what day it is 145 days from now, what would you answer? Would you count 145 days, or find a quicker

More information

LECTURE 3 C++ Basics Part 2

LECTURE 3 C++ Basics Part 2 LECTURE 3 C++ Basics Part 2 OVERVIEW Operators Type Conversions OPERATORS Operators are special built-in symbols that have functionality, and work on operands. Operators are actually functions that use

More information

{ -- FLORIDA HIGH SCHOOLS COMPUTING COMPETITION '84 } { -- PASCAL PROGRAM SOLUTIONS }

{ -- FLORIDA HIGH SCHOOLS COMPUTING COMPETITION '84 } { -- PASCAL PROGRAM SOLUTIONS } { -- FLORIDA HIGH SCHOOLS COMPUTING COMPETITION '84 } { -- PASCAL PROGRAM SOLUTIONS } {1.1} program One1T84; { -- This program produces a table of Fahrenheit for Celcius. } C: Integer; Writeln ('CELCIUS

More information

Computers Programming Course 6. Iulian Năstac

Computers Programming Course 6. Iulian Năstac Computers Programming Course 6 Iulian Năstac Recap from previous course Data types four basic arithmetic type specifiers: char int float double void optional specifiers: signed, unsigned short long 2 Recap

More information

2. MACHINE REPRESENTATION OF TYPICAL ARITHMETIC DATA FORMATS (NATURAL AND INTEGER NUMBERS).

2. MACHINE REPRESENTATION OF TYPICAL ARITHMETIC DATA FORMATS (NATURAL AND INTEGER NUMBERS). 2. MACHINE REPRESENTATION OF TYPICAL ARITHMETIC DATA FORMATS (NATURAL AND INTEGER NUMBERS). 2.. Natural Binary Code (NBC). The positional code with base 2 (B=2), introduced in Exercise, is used to encode

More information

MagicCalc 4.49 Product Manual

MagicCalc 4.49 Product Manual 1 MagicCalc 4.49 Product Manual Publication Date: 08 February 2014 Copyright HOUCINE ROMDHANE Please check www.magiccalc.net periodically for product manual updates. 1 INTERFACE DESCRIPTION:... 3 2 AVAILABLE

More information

Operators. Java operators are classified into three categories:

Operators. Java operators are classified into three categories: Operators Operators are symbols that perform arithmetic and logical operations on operands and provide a meaningful result. Operands are data values (variables or constants) which are involved in operations.

More information

Introduction to Programming

Introduction to Programming Introduction to Programming Python Lab 3: Arithmetic PythonLab3 lecture slides.ppt 26 January 2018 Ping Brennan (p.brennan@bbk.ac.uk) 1 Getting Started Create a new folder in your disk space with the name

More information

Introduction to Programming

Introduction to Programming Introduction to Programming session 5 Instructor: Reza Entezari-Maleki Email: entezari@ce.sharif.edu 1 Fall 2010 These slides are created using Deitel s slides Sahrif University of Technology Outlines

More information

Making Decisions In Pascal

Making Decisions In Pascal Making Decisions In Pascal In this section of notes you will learn how to have your Pascal programs choose between alternative courses of action High Level View Of Decision Making For The Computer??? True

More information

3. EXPRESSIONS. It is a sequence of operands and operators that reduce to a single value.

3. EXPRESSIONS. It is a sequence of operands and operators that reduce to a single value. 3. EXPRESSIONS It is a sequence of operands and operators that reduce to a single value. Operator : It is a symbolic token that represents an action to be taken. Ex: * is an multiplication operator. Operand:

More information

Department of Computer Applications

Department of Computer Applications Sheikh Ul Alam Memorial Degree College Mr. Ovass Shafi. (Assistant Professor) C Language An Overview (History of C) C programming languages is the only programming language which falls under the category

More information

Expressions and Data Types CSC 121 Spring 2015 Howard Rosenthal

Expressions and Data Types CSC 121 Spring 2015 Howard Rosenthal Expressions and Data Types CSC 121 Spring 2015 Howard Rosenthal Lesson Goals Understand the basic constructs of a Java Program Understand how to use basic identifiers Understand simple Java data types

More information

Macro Programming Reference Guide. Copyright 2005 Scott Martinez

Macro Programming Reference Guide. Copyright 2005 Scott Martinez Macro Programming Reference Guide Copyright 2005 Scott Martinez Section 1. Section 2. Section 3. Section 4. Section 5. Section 6. Section 7. What is macro programming What are Variables What are Expressions

More information

Java provides a rich set of operators to manipulate variables. We can divide all the Java operators into the following groups:

Java provides a rich set of operators to manipulate variables. We can divide all the Java operators into the following groups: Basic Operators Java provides a rich set of operators to manipulate variables. We can divide all the Java operators into the following groups: Arithmetic Operators Relational Operators Bitwise Operators

More information

By the end of this section you should: Understand what the variables are and why they are used. Use C++ built in data types to create program

By the end of this section you should: Understand what the variables are and why they are used. Use C++ built in data types to create program 1 By the end of this section you should: Understand what the variables are and why they are used. Use C++ built in data types to create program variables. Apply C++ syntax rules to declare variables, initialize

More information

LESSON 2 VARIABLES, OPERATORS, EXPRESSIONS, AND USER INPUT

LESSON 2 VARIABLES, OPERATORS, EXPRESSIONS, AND USER INPUT LESSON VARIABLES, OPERATORS, EXPRESSIONS, AND USER INPUT PROF. JOHN P. BAUGH PROFJPBAUGH@GMAIL.COM PROFJPBAUGH.COM CONTENTS INTRODUCTION... Assumptions.... Variables and Data Types..... Numeric Data Types:

More information

Week 4 Lecture 1. Expressions and Functions

Week 4 Lecture 1. Expressions and Functions Lecture 1 Expressions and Functions Expressions A representation of a value Expressions have a type Expressions have a value Examples 1 + 2: type int; value 3 1.2 + 3: type float; value 4.2 2 More expression

More information

Prof. Navrati Saxena TA: Rochak Sachan

Prof. Navrati Saxena TA: Rochak Sachan JAVA Prof. Navrati Saxena TA: Rochak Sachan Operators Operator Arithmetic Relational Logical Bitwise 1. Arithmetic Operators are used in mathematical expressions. S.N. 0 Operator Result 1. + Addition 6.

More information