0% found this document useful (0 votes)
9 views4 pages

Problem Solving Part1

The document discusses basic computer science concepts for medical students including: 1. Problem solving involves input, processing, and output of data and information. 2. Common data types are integers, real numbers, strings, and booleans. 3. Variables store data that can change, while constants store data that remains the same. 4. Arithmetic, relational, logical, and precedence of operators are explained for evaluating expressions.

Uploaded by

Mohab Nobani
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views4 pages

Problem Solving Part1

The document discusses basic computer science concepts for medical students including: 1. Problem solving involves input, processing, and output of data and information. 2. Common data types are integers, real numbers, strings, and booleans. 3. Variables store data that can change, while constants store data that remains the same. 4. Arithmetic, relational, logical, and precedence of operators are explained for evaluating expressions.

Uploaded by

Mohab Nobani
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

Computer Skills for Medical Students

Problem Solving

Problem Solving

Input  Processing  output


(Data) (Information)

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:

7 , 220 , -18, 0 , 350 .. etc

2. Real Numbers

Real numbers are the numbers with the fractional part.

Examples: 3.5 ,6.0, -8.0 ,0.0 , 1.3

3. String

Sequence of characters, characters can be:

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

Variables and Constants

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.

Left side Right Side

Variable = - Value (A=3,B=3.5,C="dana " , y=true)


- Another variable (A=B)
- Expression (a=b+5)

Invalid Assignment Statements: (5=y, L+5=m)

Arithmetic Operators:

+ Addition 3+2= 5, -3+2=-1, -2+3= 1


- Subtraction 3-2=1,2-3=-1,-2-3=-5
* Multiplication 2*3=6,-2*3=-6,2*-3=-6,-2*-3=6
/ Division 3/2=1.5,-3/2=-1.5,3/-2=-1.5,-3/-2=1.5
^ Power 2^3=8 ,2^-1=0.5 , -2^2=4
mod Modulus 5 mod 2= 1 , 6 mod 3= 0 ,4 mod 6= 4 ..etc

Relational operators:

> Greater than 3>2 = true , 4>10 = false


< Less than 6<10= true , -8<-10 = false
>= Greater than or equal 5>=5 = true
<= Less than or equal -4<=4 = true ,
= Equal 5=6 = false , -3=-3 = True
<> Doesn’t equal 2<>4= true , 2<>2= false
Computer Skills for Medical Students
Problem Solving

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

Operators Precedence(from Highest to Lowest):

( )

*, /

mod

+,-

>,<,>=,<=,=,<>

NOT

AND

OR
Computer Skills for Medical Students
Problem Solving

Evaluate the following expressions:

 X=3.6+ 9 mod (6*(3+2))/2+2^(3-2)*2 Answer : 16.6

 Y= 6*3-(4+2)*2+10 mod 3^1^2-8 Answer : -1

 Z=(2+1)^((4+8)/4)+1 Answer: 28

 X= 2+3> 1 and 5<> 9/3 or 5+4=8 Answer: True

 Y= 3>= 9 or (5+1) <> 2 and NOT (( 7-3)<2 or NOT F) Answer: false

You might also like