Class 1 C
Class 1 C
Class 1 C
Shaik Mastan
Topics
Programming languages Types of Programming languages Logic and problem solving Problem solving phase Writing algorithm Draw flowchart Implementation phase
Programming Language
A program is set of instructions used to build up a software program.
Examples:
FORTRAN JAVA COBOL C BASIC C ++ PASCAL
A text editor is used to write a program. Example: Notepad, Turbo editor, Norton editor
..
abbreviations for standard repeated functions such as ADD for addition, SUB for subtraction, MUL for multiply, HLT for halting or stopping the program
Thus, each assembly language code was restricted to a particular machine and required a Translator to convert it to a machine usable form.
WHY C
C is simple it is one of the most powerful languages
It is language on which C++ is based on, hence C# also derive its origin from the C. Java is also a distant cousin of C and share the same programming concept and syntax of C.
Major parts of the Windows, Unix and Linux are still written in C. Device drivers of new devices are always written in C.
Programming Task
A programming task can be divided into two phases Problem solving phase : Produce an ordered sequence of steps that describe solution of problem. This sequence of steps is called an algorithm Implementation phase: Implement the program in some programming language
ALGORITHM
An algorithm is a step by step procedure to solve a problem in a finite amount of time. The following criteria should satisfy the algorithm: Input, output, effective ness, infiniteness. Example: Input a set of 3 marks Calculate their average by summing and dividing by 3 if average is below 50 Print FAIL else Print PASS
Detailed Algorithm
Step 1: Input S1, S2, S3 Step 2: Average = (S1+S2+S3)/3 Step 3: if (Average < 50) then Print FAIL else Print PASS endif
EXAMPLE
1. Algorithm for addition of two numbers Step 1: Read Two numbers N1, N2 Step 2: Find Sum Sum = N1 + N2 Step 3: Print sum