Logic of Programming in C FDP 101 x



















- Slides: 19
Logic of Programming in C FDP 101 x. Foundation Program in ICT for Education Course
Algorithm Definition: Algorithm is defined as a step by step procedure for solving any problem. It is also a precise rule (or set of rules) specifying how to solve a problem. An algorithm is a sequence of finite instructions, often used for calculation and data processing. 2 Logic of Programming in C
Algorithm has a starting point and a final point. Between these two points are the instructions that solve the problem. Algorithms often have steps that repeat or require decisions (such as logic or comparison). Algorithms can be expressed in any language from natural languages (like English, French, etc. ) to programming languages (like Basic, Fortran, python, etc. . ) 3 Logic of Programming in C
Algorithm (Find the Area of Circle) 1. Start 2. Read the value of radius r 3. Calculate - Area=3. 14*r*r 4. Print the Area of the circle 5. Stop 4 Logic of Programming in C
Steps in learning C Character Set 5 Tokens Logic of Programming in C Instructions Programs
C Character Set Source Character Set Alphabets Digits 6 Special White Characters Spaces Logic of Programming in C Execution Character Set Escape Sequence
Source Character Set Letters a to z , A to Z Digits 0 to 9 Special Characters !@#$%^&*()_-+= | { } [ ] etc, . Blank Space , Horizontal tab, New line, Vertical tab etc, . White Spaces 7 Logic of Programming in C
Executable Character Set Characters Back Space Horizontal Space 8 Escape Sequence b t Vertical Space v Newline n Logic of Programming in C
C Tokens The smallest element in the C language is the token. It may be a single character or a sequence of characters. 9 Logic of Programming in C
C Tokens (Cont) C Tokens Identifiers Keywords Constants Strings operators Eg: main, avg 10 Eg: int, for Logic of Programming in C Eg: 17, 15. 5 Eg: “ab” Eg: + - sp. I symbol Eg: # $%
Structure of C program DOCUMENTATION SECTION PREPROCESSOR SECTION DEFINITION SECTION GLOBAL DECLARATION SECTION main() { Declaration part; Executable Part; } sub program section { Body of the subprogram; } 11 Logic of Programming in C
Executing a C Program Creating the Program Compilation Linking Execution 12 Logic of Programming in C
Executing a C Program (Cont) Enter the program in a C editor. Save the program (File Save) or F 2. Use the extension. c for saving the file. Eg: sample. c Compile the program(Compile Compile) or Alt+F 9. Run the program(Run Run) or Ctrl+F 9. 13 Logic of Programming in C
C Program C program may have many functions. · One and only one of the functions MUST BE named main. · main is the starting point for the program. · main and other functions in a program are divided into two sections, declaration section and statement section. · 14 Logic of Programming in C
/* Example program in C*/ # include <stdio. h> Section #include<conio. h> Comments Preprocessor Global Declaration void main () { 15 printf (“Hello World! n”); getch(); } Output : Logic of. World Programming in C Hello Local declaration Statements
Quiz time !! Libray function getch() belongs to which header file? A. stdio. h B. conio. h 16 Logic of Programming in C
FDP 101 x. Foundation Program in ICT for Education Course For more details visit https: //wordpress. com/page/anucsekit. wordpress. com/17 17 Logic of Programming in C
Word Press Webpage 18 Logic of Programming in C
Thank You!! 19 Logic of Programming in C



















