Lecture 1
Lecture 1
Lecture 1
Assembly Languages
High-Level Languages
C=A+B
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
Wet Hair
Apply Shampoo
Rinse
Wash
No
If unclea n
Yes
Stop
Book: Magnefying C By Dr. Arpita Gopal.....Prepared by Sharada Patil 8
10
67 1057
990
20 29
Start
Read a
Read b
som = a + b
Print som
Stop
Memory Tracing: a b
67
990
1057
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.
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