Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Introduction to problem solving in C

20,974 views

Published on

simply read some fundamental of C programming language............

Published in: Education, Technology

Introduction to problem solving in C

  1. 1. What is programming ? A set of instruction to solve the problem or the specification of the sequence of computational steps in a particular programming language is called program. The task of developing programs is called programming .
  2. 2. What is algorithm ? A logical and concise list of steps required to solve a problem is called algorithm. Languagically representation of the various steps involved in solving problem is called algorithm.
  3. 3. Points for developing algorithm Every procedure should carefully specify the input & output requirements. Meaning of variable should be clearly defined. Easy to understand and can be implemented in any program language. It should terminate after a binite number of operations.
  4. 4. Flowchart A flowchart is pictorial representations of step by step solution of a program. Symbolically representations various steps include in solving problem is called flowchart.
  5. 5. Flowchart symbols Terminal box :-include start/stop box---------------------------------------------------------------- Processing box:-straight forward computationarraignment operation .
  6. 6.  Input/output box :-Used for input data &giving result in outputmerrage.---------------------------------------------------------------------- -. Internal sub-routine:- represents predefined module .
  7. 7.  Decision box :- to chosen between two three blanching leading other part of flowchart------------------------------------------------------------------- -----Flow lines:- used to connect different boxes & indicates direction of flow.------------------------------------------------------------------- ----Connectors:- connects different parts of flowchart.
  8. 8. Benefits of usingflowcharts. Being a pictorial representations they are easier to understand . We can review our logic & debug the program with the help of flowcharts. Easy to explain a program or discuss the solution . It separates the logic development & program syntax.
  9. 9. Computer program The set of instructions that is provided to the computer to solve the problem is called as program.
  10. 10. Components of a program Comment entry:- An entry following the symbol // indicates a comment entry , and used to specify a comment it increases readability and clarity of a program for documentation purpose . Program name:- program are indicates name of the program. Decimeters:- ‘{‘&’}’ indicates beginning and ending mark of the program. Sentences:- each line of a program is a sentence. Sentence terminator:- each statement is to be terminated with a semicolon (;) which is called sentence terminator. Keywords:- words used for specific purpose in program.
  11. 11. Characteristic variable in a program The program should be able to provide accurate & variable output . The program should be variable ie it should continue to work accurately over a period of time . Program should be able to manage the resources efficiently . Structure of the program should allow further modification it required without changing the previous written code. Program should be readable .
  12. 12. Programming paradigm The systematic and organized principle of writing a program is called as programming paradigm . There are different types of programming paradigms.
  13. 13. Procedural programming In this approach , the problem is viewed as a sequence of things to be done as reading , calculating & printing . The principle of this programming is “ decide which procedure you want ; use the best algorithm you can find”.
  14. 14. General model of procedure-oriented programming depicts thefollowing characteristics . Emphases is on doing things . Global data is loosely available to all function. Data more openly around the system from function to function.
  15. 15. Drawbacks of procedure orientedapproach. It is unstructured which gives result generally in composed code , which is difficult to understand & maintain . In a large program it is very difficult to identity what data is used by which function. Due to its open availability , global data are more vulnerable . It does not encourage reusability of code.
  16. 16. Structured approach Structured programming is process in which we break the overall program into separate pieces of modules . The program will more complex when branching and looping are used then this procedures is used to make them less error and much easier to debug. Structuring a program helps to break it down into under stable chunks .
  17. 17. Advantage of structured approach Modification of enhancement in programs becomes much easier due to reduction in the main problem . It adds the concept of hierarchies and modules with single entry and exit points. Decreases debugging time . Allows several programmers to code simultaneously. Sequence , selection , iteration are basic construction of structed programming .
  18. 18. Modular approach A system or program is considered modular if it consists of direct modules so that each modules can be separately implemented . And a change in one module has minimal impact on other modules . { module is a logically separable part of a program or a set of related procedures with the data they manipulate is called module . It can be a macro , a function , a procedure , a process or a package .} . This approach is based upon this principle . “ Decide which module you want ; partition the program so that data is hidden in modules .” cont.1
  19. 19. Cont.2Under this approach a program can be logically separated into following functional module :- 1). Initialization 2). Input 3). Input data validation 4). Processing 5). Output 6). Error handling 7). Closing procedure
  20. 20. Advantage of modular approach Testing of individual modules in isolation makes easier to find errors . Modules can be kept separately In a library & used any where in the program without reverting them . A module can use other modules . The documentation of a large program is simplified by the documentation of individual modules . It save development time .
  21. 21. Top down approach A top down design approach start by identifying the major modules of the program i.e. decomposing them into their low level modules & repeating until the desired level of details is achieved first the main module is implemented & then their subroutine and so. on .
  22. 22. THANK YOU

×