Anda di halaman 1dari 14

SEMANTIC ASPECTS

Book: Magnifying C By Dr. Arpita Gopal

Lecture Prepared By Sharada Patil

Basic Computer Model And Understanding Memory


Input Device Output Device CPU Main Memory Secondary Memory

Book: Magnefying C By Dr. Arpita Gopal.....Prepared by Sharada Patil

Computer Languages and Programming


Machine Languages

Machine Language Assembly Language High Level Language

+130004277 4 +140059341 9 +120027402 7

Assembly Languages

LOAD A ADD B STORE C

High-Level Languages

C=A+B

Book: Magnefying C By Dr. Arpita Gopal.....Prepared by Sharada Patil

Understanding Semantic (Logic)


Problem Statement Logic Analysis Result Techniques to represent Semantic
Flowchart Algorithm or Logic
Book: Magnefying C By Dr. Arpita Gopal.....Prepared by Sharada Patil 4

Problem Statement:Shampooing
Logic
Step1 : Wet Hair Step 2 : Apply Shampoo Step 3 : Rinse Step 4 : Wash Step 5 : Repeat Again From Step 2

Analysis : We start from Step 1 to Step 5 infinite times Result : Either No hair or No Shampoo
Book: Magnefying C By Dr. Arpita Gopal.....Prepared by Sharada Patil 5

Problem Statement:Shampooing
Corrected Logic
Step1 : Wet Hair Step 2 : Apply Shampoo Step 3 : Rinse Step 4 : Wash Step 5 : If hair remain unclean, repeat Again From Step 2 Else Stop

Analysis : We start from Step 1 and go forward. If we do so gradually come to step 5, check if hair are unclean. If yes, again go to step 2 else STOP. Result : Clean Hair
Book: Magnefying C By Dr. Arpita Gopal.....Prepared by Sharada Patil 6

Flowcharting
Start/ Stop Read/Print Calculation Decision Flow Connector Other

Book: Magnefying C By Dr. Arpita Gopal.....Prepared by Sharada Patil

Flow Chart Example


Draw a flowchart for Shampooing
Start

Wet Hair

Apply Shampoo

Rinse

Wash

No

If unclea n

Yes

Stop
Book: Magnefying C By Dr. Arpita Gopal.....Prepared by Sharada Patil 8

Flow Chart Example


Draw a flowchart to calculate area of rectangle.

Book: Magnefying C By Dr. Arpita Gopal.....Prepared by Sharada Patil

Flow Chart Example


Draw a flowchart to calculate percentage of the student .

Book: Magnefying C By Dr. Arpita Gopal.....Prepared by Sharada Patil

10

Problem Statement Input / Output Input Expected Output Logic:

Read two numbers and produce the sum of those numbers.

67 1057

990

Another Input 9 Expected Output

20 29

Start

Read a

Read b

som = a + b

Print som

Stop

Memory Tracing: a b

67

990

1057

Book: Magnefying C By Dr. Arpita Gopal.....Prepared by Sharada Patil

som

11

Class Work
Read Two Numbers and produce the sum of those numbers Read two number and find out greatest number out of two numbers. Read two number and print greater number If both are equal print EQUAL. Read three number and find out greatest number out of 3 numbers. Read Number n and print counting up to n Read a number n and prints even numbers up to n Read a number n and prints odd numbers up to n Read a number n and print the number-line for n
Book: Magnefying C By Dr. Arpita Gopal.....Prepared by Sharada Patil 12

Homework
Read a number n and print the sum of n natural numbers Draw a flowchart to check whether the given number is positive or negative ? Draw a flowchart to find out smallest number out of two numbers. Draw a flowchart to find out largest number out of four numbers Draw a flowchart to print first 50 odd numbers. Draw a flowchart to find out sum and average of given N numbers Draw a flowchart to find out factorial of given numbers Draw a flowchart to solve following series. 1-x+x2-x3 +---xn Write an algorithm and draw flowchart for finding sum digits of a number. Write an algorithm and draw the flowchart of a program to find the maximum of 'n' numbers.

Book: Magnefying C By Dr. Arpita Gopal.....Prepared by Sharada Patil

13

Thank You!
Please Remember! Live your life each day as you would climb a mountain
Book: Magnefying C By Dr. Arpita Gopal.....Prepared by Sharada Patil 14

Anda mungkin juga menyukai