Unit I C Language Review Ref. Book: Yashavant Kanetkar, “Let Us C”, BPB Publications, 10/E, 2010
Contents 1.Algorithms, flowcharts 2.Data types in C 3.The C character set: Constants, Variables and keywords 4.Decision Control
Algorithm and Flowchart A sequential solution of any program that written in human language, called algorithm. Algorithm is first step of the solution process, after the analysis of problem, programmer write the algorithm of that problem. Graphical representation of any program is called flowchart.
Symbols Used in flowchart
Algorithm 1.Start 2.Input Current ( I ) and resistance( R) 3.Calculate voltage V= I*R 4.Display the voltage, V 5.Stop
Start Calculate V= I * R Input I and R Print V Stop
Data Types in C Variable TypeKeywordByte reqdRangeFormat Character (signed) char1-128 to +127%c Integer ( Signed) int to %d Float ( signed)float4-3.4e30 to + 3.4e38%f Doubledouble8-1.7e308 to + 1.7e308%lf Long Integerlong to %ld Character ( unsigned) unsigned char10 to 255%c Integer ( unsigned) unsigned int20 to 65535%u Unsigned long integer Unsigned long40 to %lu Long Doublelong double10-1.7e932 to +1.7e932%lf
Constants, Variables, Keyword Smallest individual unit value that does not change during the execution of a program e.G PI,”Ram”, “a” A variable is a name, given to a temporary memory location that has been used to store any value. e.g salary, a,b,A,B etc. Keywords are the words whose meaning has already been explained to the compiler. e.g if, else, break, switch,int,float, union etc
Decision control if statement if else statement Nested if statement switch case statement
if statement If (this condition (expression) is true ) { execute this statement; } Expression is true if x == y x is equal to y x !=y x is not equal to y x y x is greater than y x = y x is greater than or equal to y if (per < 40 ) { printf ( “fail” ) } if ( per >=40 && per <=50) { printf(“Pass class”); }
if else if(condition) { statements; } else { statements; } if ( remainder is zero) { printf(“Even number”); } else { printf(“Odd number”); }
Nested if
switch case switch(2) { case 1: statement 1; break; case 2: Statement 2; break; }
Unit II Program Development concepts Ref. Book: Yashavant Kanetkar, “Let Us C”, BPB Publications, 10/E, 2010
contents The loop control structure Functions and pointers Arrays
Loop Control Structure Looping : – while loop – do while loop – for loop Loop Control – break -- exit from loop or switch. – continue -- skip 1 iteration of loop.
Unit III Numerical computational techniques 1 a. Solution of transcendental & polynomial equation. b. Solution of bisection method. c. Solution of Newton Raphson method. Ref. Book: S.S. Shashtry, “Introductory Methods of Numerical”, Tata McGraw Hill.
Unit IV Numerical computational techniques 2 a. Solution of secant method. b. Solution of linear equations using Gauss elimination method and Gauss-Jordan methods. c. Numerical integration and differentiation: trapezoidal rule Simpson's 1/3 and 3/8 rule.. Ref. Book: S.S. Sastry, “Introductory Methods of Numerical”, Tata McGraw Hill.
Unit V MATLAB a. Introduction, Basics of MATLAB b. Working with arrays of numbers c. Creating and printing simple plots d. Creating and executing a Script file, function file. e. Interactive computations: Matrices and vectors, Matrix and array operation. f. Graphics: Basic 2-D plots, 3-D plots. MATLAB Release Notes for Release 12, The Math Works, Inc., 2000.
Practical List 1. Bisection Method program. 2. Secant Method program. 3. Newton Raphson Method program. 4. Gauss Elimination Method Program. 5. Gauss seidal Method Program. 6. Simpson`s 1/3 rd and 3/8 th rule program. 7. Arithmetic operations on matrix using MATLAB. 8. Plot the simple, 2-D and 3-D plots using MATLAB. 9. Find the roots of polynomial equations using MATLAB. 10. Find eigenvalues and eigenvectors, LU factorization. Note: Lab file should consist of minimum Eight experiments.