Looking for a Tutor Near You?

Post Learning Requirement »
x

Choose Country Code

x

Direction

x

Ask a Question

x

x
x
x
Hire a Tutor

C Language Logic Building

Loading...

Published in: C / C++
3,061 Views

C Language Logic Building-Presentation

Ketan / Gurgaon

7 years of teaching experience

Qualification: 12th (cbse),btech comp.sci.(undergoing)

Teaches: All Subjects, Computer, English, EVS, Mathematics, Social Studies, Chemistry, History, Counting Skills, Reading Skills, Writing Skills

Contact this Tutor
  1. UNIT-?
  2. Logic and Problem Solving
  3. Logic & Problem solving Objective: to enable the learner to approach real world problems in a systematic manner, which is an essential skill for a software engineer. Outcomes: At the end, the learner will be able to Classify & analyze a given problem Understand the problem solving lifecycle and apply it for real world situations
  4. Types of Problems Social Political Problems Computational Etc...
  5. Examples of Computational Problems where the answer for every instance is either yes or no. Searching an element from a given set of elements. Or arran in them in an order Counting no. of occurrences of a type of elements in a set of elements Finding the best solution out of several feasible solutions Decision Problem Searching & Sortißi% Counting Problem Optimization Problem Deciding whether a given number is prime Finding product name for given product ID and arranging products in alphabetical order of names Counting how many different type of items are available in the store Finding best combination of products for promotional
  6. Exercise 1. 2. What comes in your mind when you hear the word problem? List down the different words that you have come across. Then try to search the problems which you can completely solve with computer.
  7. Classification of computational problems Computational Problems Concurrent Sequential Distributed Operations overlap in time Operations are performed in a step-by-step manner Operations are performed at different locations
  8. Exercise Make a list of different examples of computational problems Find out who is the topper of your class ( arrange in ascending or descending order) Calculate the average score of your class
  9. Distributed Example Billing process at multiple Point of Sales of a retail shop POS POS 4
  10. Sequential/ Event Based Example Withdrawing money using ATM DONE! I rt Card ATM Enter Into ATM Collect Card rnllprt raqh 5 Verify Pin PI YES/N Check balance / Update Balance Enter Amount
  11. Exercise A Retail Store Demand Planning Inventory Control Back Office Shelf Store layout Item Management Point Of Sale Billing Pricing Promotions Identify the possible computational problems
  12. Problem Solving Life Cycle What do you understand with Under- point of sale problem? What plan can you prepare for solving the problem? 2. Makea 4. Look back i.e. How can you ensure the SUCCess of the plan? solution 3. Carry How will you carry out the plan? out the
  13. Exercise. A Retail Store Demand Planning Inventory Control • Lifecycle Back Office Shelf Store layout Item Management Point Of Sale Billing Pricing Promotions Identify the different steps involved in automating the billing activity in a Retail Store.
  14. Need of Algorithms It should be able to interpret each instruction in the algorithm and carry it out. It should be able to read a text containing of a set of characters. It should be able to add and divide. It should be able to store (or remember) computed values. It should be able to write (or output) the answers obtained.
  15. Algorithms Representation of computation Following notations are used for representing algorithms:- Flowchart: graphical representation Pseudo code: look like English statements with additional qualities.
  16. Example Flow of activities for withdrawing money from ATM??
  17. Definition Finite set of steps to accomplish a task Ego: Algorithm to add two numbers? Begin Stepl: accept two numbers in A and B. Step2: C=A+B. Step3: display C. End
  18. Properties of an Algorithm Algorithm Finiteness Definiteness Input Output Effectiveness Must terminate after a finite number of steps Action in each step to be carried out must be rigorously and unambiguously specified Has zero or more inputs that are provided to it initially or dynamically Has one or more outputs; quantities that have a specified relation to inputs Operations must all be sufficiently basic
  19. Steps to develop an Algorithm Identify the Inputs and Outputs Write the Algorithm Identify any other data and constants required to solve the problem (Requires Logic) Identify what needs to be computed and how will it be computed (Requires Logic)
  20. Various patterns in algorithms in Algorithm Sequential Selectional (Conditional) Iterational (Loop) Recursive Executes the statements in the order in which they appear in the algorithm Controls the flow of statements execution based on some condition Used when a part of the algorithm is to be executed several times The functions computed by the algorithms are expressed in terms of itself
  21. Example 1 Write an algorithm to find the average marks scored by a student in three subjects. BEGIN inputs Stepl: accept marks for 3 subjects in marksl, ma s and marks3. Step2: add marksl marks2 and marks3 and store the result in Total. constant Step3: divide Total by 3 and find the average. output Step4: display average. END
  22. Example 2 Write an algorithm to find the average marks scored by a student. Also check whether the student has passed or failed. For a student to pass, the average marks secured should be 65.
  23. BEGIN Stepl: accept markl, mark2 and mark3. Step2: Total=mark1+mark2+mark3. Step3: Average=TotaI/3. Step4: set output ="Student has passed". Step5: if Average
  24. Example 3- Selectional Write an algorithm to find whether a given year is leap year or not. BEGIN Stepl: accept the year. Step2: if ((year%4=O and year%100!=0) or (year%400=0)) else End-If END display "year is a leap year" display "year is not a leap year"
  25. Example 4- Iterational Write an algorithm to find the average marks scored by 'N' number of students.
  26. BEGIN Stepl: accept NumberOfStudents. Step2: counter=l. Step3: read marksl, marks2 and marks3. Step4: Total=marks1+marks2+marks3. Step5: Average=TotaI/3. Step6: set output= "student passed". Step7: if (Average
  27. Example 5-Recursion Recursive algorithms are functions computed by the algorithms that are expressed in terms of itself. Write an algorithm to find the factorial of a positive integer 'n'.
  28. Algorithm Factorial(n) BEGIN Terminating condition. The smallest instance of the problem whose solution is known. else return(n*FactoriaI(n-1)) END Call itself, but for the instance 1 smaller than the previous call.
  29. Exercise Identify some problem in a retail store. Design an algorithm to solve the same. A Retail Store Demand Planning Inventory Control Back Office Shelf Item Management Point Of Sale Billing Pricing Promotions