Problem Solving Part1
Problem Solving Part1
Problem Solving
Problem Solving
Data Type
Data type is the kind of data that can be stored in a variable. There is a number of traditional
datatypes found in programming languages such as:
1. Integers
Integers are numeric data items. The integer is the whole number without fractional part.
An integer number can be either positive, negative or zero.
Examples:
2. Real Numbers
3. String
1. Digits : 0…9
2. Letters: A..Z,a…z
3. Special Symbols: @, . ; : ? …etc
If the string consists of one character it must be enclosed between single quote, if it
has more than one character it must be enclosed between double quotes.
Examples: "rasha " , "Patient" , "data1" , “120@lab” , ‘A’ , ‘@’ , ‘1’ …etc
4. Booleans
Are data items used as status indicators and it can be either TRUE or FALSE.
Computer Skills for Medical Students
Problem Solving
A variable is a named memory location which temporarily stores data that can change at any
point while the program is running.
A constant is a named memory location which temporarily stores data that remains the same
throughout the execution of the program.
Assignment Statement
The right side in the assignment statement is stored in the left side.
Both left side and right side must have the same data type.
Arithmetic Operators:
Relational operators:
Logical Operators:
NOT NOT T = F
NOT F= T
AND T AND T= T
T AND F= F
F AND T = F
F AND F = F
OR T OR T= T
T OR F= T
F OR T= T
F OR F = F
( )
*, /
mod
+,-
>,<,>=,<=,=,<>
NOT
AND
OR
Computer Skills for Medical Students
Problem Solving
Z=(2+1)^((4+8)/4)+1 Answer: 28