Basic Data Types (almost all P.Languages) • int ---- integer – Whole number • float ---- floating point – number with decimal point • double ---- for bigger or larger numbers with decimal point • char - character – single letter, symbol, or number enclosed commonly by single quotes
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
8/7/2019 3 Flowcharts
http://slidepdf.com/reader/full/3-flowcharts 1/21
Basic Data Types(almost all P.Languages)
• int ---- integer – Whole number
• float ---- floating point – number with
decimal point• double ---- for bigger or larger
numbers with decimal point
• char - character – single letter, symbol,
or number enclosed commonly bysingle quotes
8/7/2019 3 Flowcharts
http://slidepdf.com/reader/full/3-flowcharts 2/21
Arithmetic Operators
Symbols Meaning
+ Addition
- Subtraction
* Multiplication
/ Division
% Modulus(Remainder)
8/7/2019 3 Flowcharts
http://slidepdf.com/reader/full/3-flowcharts 3/21
Hierarchy of Arithmetic Operator
MDAS RULE
FROM LEFT TO RIGHT
8/7/2019 3 Flowcharts
http://slidepdf.com/reader/full/3-flowcharts 4/21
Assignment Operator
= (single equal sign)
---- use to assign valueto a variable
8/7/2019 3 Flowcharts
http://slidepdf.com/reader/full/3-flowcharts 5/21
Relational Operators
Symbols Meaning
> Greater than
>= Greater than or Equal to
< Less than
<= Less than or Equal to
== Equal to
!= Not Equal to
8/7/2019 3 Flowcharts
http://slidepdf.com/reader/full/3-flowcharts 6/21
Logical Operator
Symbols Meaning
&& and
|| or
! not
8/7/2019 3 Flowcharts
http://slidepdf.com/reader/full/3-flowcharts 7/21
Logical Operator
A B Z = A&&B
0 0 0
0 1 0
1 0 0
1 1 1
A B Z = A||B
0 0 0
0 1 1
1 0 1
1 1 1
Logical AND(&&) Logical OR(||)
Logical NOT(!)
A Z = !A
0 1
1 0
8/7/2019 3 Flowcharts
http://slidepdf.com/reader/full/3-flowcharts 8/21
Programming Exercises
PROBLEMS
8/7/2019 3 Flowcharts
http://slidepdf.com/reader/full/3-flowcharts 9/21
Problem no.1
• Create a flowchart that calculates thesum of two input number and displaythe result.