You are on page 1of 47

Format for Summer Training Report


The sequence in which the training report material should be arranged and bound as follows:

1. Cover Page
2. Inner Title Page (Same as cover page)
3. Certificate by Company/Industry/Institute
4. Declaration
5. Acknowledgement
6. Abstract
7. About Company/industry/institute (if required)
8. Table of Contents
9. List of Tables
10. List of Figures
11. Abbreviations
12. Chapters
13. References

The tables and figures shall be introduced in the appropriate places.


1. The report May be submitted either I hard bound or spiral bound.

2. The length of the training report may be about 30 to 40 page.
3. The report shall be computer typed (English- British, Font -Times New Roman, Size-12
point) and printed on A4 size paper.
4. The report shall be typed with 1.5 line spacing with a margin 3.5 cm on the left, 2.5 cm on
the top, and 1.25 cm on the right and at bottom. Every page in the report must be numbered.
5. The page numbering, starting from acknowledgements and till the beginning of the
introductory chapter, should be printed in small Roman numbers, i.e, i, ii, iii, iv
6. The table of contents should list all headings and sub-headings. The title page and
certificates will not find a place among the items listed in the Table of Contents. One and
a half line spacing should be adopted for typing the matter under this head.
7. The list of tables should use exactly the same captions as they appear above the tables in
the text. One and a half spacing should be adopted for typing the matter under this head.
8. The list of figures should use exactly the same captions as they appear below the figures
in the text. One and a half spacing should be adopted for typing the matter under this head.
9. The list of symbols, abbreviation & nomenclature should be typed with one and a half line
spacing. Standard symbols, abbreviation etc should be used.
10. Training report should consist of following chapters.

a. Chapter 1- Introduction
b. Chapter 2- Project work

(It will be divided into several chapters and each chapter should be numbered separately. A chapter
may be further divided into several divisions and sub-divisions depending on type & volume
of work. This contains the text & related to hardware & software implementation).

c. Chapter 3- Result & Discussion.

d. Chapter 4- Conclusion & Future Scope.

(The chapter No. of chapter 3 & 4 may vary depending on number of chapters covered in ‘Project
Work’ chapter)

Each chapter should be given an appropriate title. Tables & figures in a chapter should be placed
in the immediate vicinity of the reference where they are cited. A typical illustrative list given
below relates to the citation example quoted above.


1. Barnard, R.W. and Kellogg, C. (1980) ‘Applications of Convolution Operators to Problems in

Univalent Function Theory’, Michigan Mach, J., Vol.27, pp.81–94.

3. Shin, K.G. and Mckay, N.D. (1984) ‘Open Loop Minimum Time Control of Mechanical
Manipulations and its Applications’, Proc.Amer.Contr.Conf., San Diego, CA, pp. 1231-1236.

4. from web site accessed on 12/08/2007.

13. Enclose data sheet with your report, if any.

Following colors are available for use in c graphics programming.

Colors table
Color Value
















Total number of colors available depend on current graphics driver and mode. Use colors name
in capital letters, for example use setcolor(RED) not setcolor(red) the latter will give you an
error. You may use number instead of color for example setbkcolor(GREEN) or setbkcolor(2)
are same, but you are advised to use color name as it will improve readability of program.

delay function in C
Delay in C: delay function is used to suspend execution of a program for a particular time.
Declaration :- void delay(unsigned int);

Here unsigned int is the number of milliseconds ( remember 1 second = 1000 milliseconds ). To
use delay function in your program you should include the dos.h header file.

C programming code for delay


printf("This C program will exit in 10 seconds.\n");


return 0;
Above C program exits in ten seconds, after the printf function is executed the program waits for
10000 milliseconds or 10 seconds and then program termination occurs.

 Delay function is used to suspend execution of a program for a particular time.

 It requires Unsigned Integer as Parameter
 Unsigned int is number in miliseconds
 Note 1sec = 1000miliseconds
 Header File : dos.h

sound c
Sound function produces the sound of a specified frequency. Used for adding music to c
program, try to use some random values in loop, vary delay and enjoy.

Declaration:- void sound(unsigned frequency);

C programming code for sound


int a;

for ( a = 200 ; a <= 1000 ; a = a + 20 )


return 0;

nosound c
nosound function turn off the PC speaker.

Declaration : void nosound();

C programming code for nosound



return 0;

sleep c
Sleep function delays program execution for a given number of seconds.

Declaration: void sleep(unsigned seconds);

C programming code for sleep


printf("Wait for 5 seconds to exit.\n");
return 0;
Summer Training Report

Submitted in partial fulfillment of the
requirement for the award of the degree


Submitted by

[Aman Kumar Singh]




Month – NOVEMBER Year-2017


I hereby declare that this submission is my own work and that, to the best of my
knowledge and belief, it contains no material previously published or written by another
person nor material which to a substantial extent has been accepted for the award of any
other degree or diploma of the university or other institute of higher learning, except
where due acknowledgment has been made in the text.

Name Aman Kumar Singh

Roll No. 201510101130005
Date 14/11/2017

It gives us a great sense of pleasure to present the report of the B.C.A Project undertaken
during B.C.A. (Summer Training) Shri Ramswaroop Memorial University for his
constant support and guidance throughout the course of our work.

We also do not like to miss the opportunity to acknowledge the contribution of all faculty
members of the department for their kind assistance and cooperation during the
development of our project. Last but not the least, we acknowledge our friends for their
contribution in the completion of the project.

Name : Aman Kumar Singh

Roll No.: 201510101130005
Date : 14/11/2017

The report present the three tasks completed During Summer Training at C Language
which are listed below :
1.Apart from C , we learned a few different thing and practically on it too. Like
2.The Test was Done after the end of each language , our performance and knowledge
Improved due to this examination .
3. Taking hard work is proof of this company
About Institute

CETPA INFOTECH PVT LTD is the leader in the “specialized training” brands of India certified by
ISO 9001:2008 for its best quality.

CETPA has been awarded as the “Best IT and Embedded Training Company” Years for delivering
high quality training and workshops . CETPA is a trustworthy brand in Education and Training
industry with its presence across several cities such as Noida, Roorkee, Lucknow, Dehradun and
Meerut. it is continuously expanding having its overseas branches in Germany and Ukraine.

Academic and training company, at CETPA learner will be offer assortments programs but the
trainers differs and make CETPA stand out from left overs. CETPA has variety of knowledgeable
and experienced trainers whose accession is different which learners can see everywhere. CETPA
try its level best to boost their trainee’s capability so that they stand out from others and whatever
they grant to the corporate world inevitably becomes fruitful.
List of Tables

Table Title Page

1 About C ………………................ 01
1.1 What is main() , purpose of printf ( ) & scanf ( )
2 Loop Control Structure
2.1 For loop
2.2 While loop
2.2 Do while
2.3 Break statement
2.4 Continue statement
3 Operators
3.1 Arithmetic operators
3.2 Increment & decrement operators
3.3 Relational operator
3.5 Logical operators
3.4 Bitwise operators
3.4 Conditional operators
4 Array
4.1 2D Array
5 String
6 Data structure
6.1 Searching sort
7.2 Bubble sort
7.3 Insertion & selection
7.4 Merge sort
8 Dynamic memory allocation
9 Linked list
9.1 Single linked list ……………………………………………………….
9.2 double linked list ………………………………………………………
9.3 Circular linked list………………………………………………………
9.4 Searching linked list ……………………………………………………
9.5 Deletion linked list …………………………………………………
10 File handling
11 Graphics ............................................................................................................
11.1 Initializing Graphics Mode
11.2 Some Functions
11.3 Color
12.1 screen saver
About c

C is a high-level and general-purpose programming language that is ideal for developing firmware
or portable applications. Originally intended for writing system software, C was developed at Bell
Labs by Dennis Ritchie for the Unix Operating System in the early 1970s
C belongs to the structured, procedural paradigms of languages. It is proven, flexible
and powerful and may be used for a variety of different applications. Although high-
level, C and assembly language share many of the same attributes.
Some of C's most important features include:

 Fixed number of keywords, including a set of control primitives, such as if, for,
while, switch and do while
 Multiple logical and mathematical operators, including bit manipulators
 Multiple assignments may be applied in a single statement.
 Function return values are not always required and may be ignored if unneeded.
What is main()

All C language programs must have a main() function. It’s the core of every program. It’s

required. The main() function doesn’t really have to do anything other than be present inside

your C source code. Eventually, it contains instructions that tell the computer to carry out

whatever task your program is designed to do. But it’s not officially required to do anything.


When the operating system runs a program in C, it passes control of the computer over to that

program. In the case of a C language program, it’s the main() function that the operating system

is looking for.

At a minimum, the main() function looks like this:

main ( )

Like all C language functions, first comes the function’s name, main, then comes a set of

parentheses, and finally comes a set of braces, also called curly braces.

If your C program contains only this line of code, you can run it. It won’t do anything, but that’s

perfect because the program doesn’t tell the computer to do anything. Even so, the operating

system found the main() function and was able to pass control to that function — which did

nothing but immediately return control right back to the operating system. It’s a perfect, flawless


 Purpose of scanf() & printf()

C programming has several in-built library functions to perform input and output tasks.

Two commonly used functions for I/O (Input/Output) are printf() and scanf().
The scanf() function reads formatted input from standard input (keyboard) .
the printf() function sends formatted output to the standard output (screen).

EX: C Output
Int main()
printf(“c programming”);
return 0;

How this program works?

 All valid C program must contain the main() function. The code execution begins from
the start of main() function.
 The printf() is a library function to send formatted output to the screen.
The printf()function is declared in "stdio.h" header file.
 Here, stdio.h is a header file (standard input output header file) and #include is a
preprocessor directive to paste the code from the header file when necessary. When the
compiler encounters printf() function and doesn't find stdio.h header file, compiler
shows error.
 The return 0; statement is the "Exit status" of the program.
Loop control structure

some part of our code to be executed more than once. We can either repeat the code in
our program or use loops instead. we need to execute some part of code for a hundred
times it is not practical to repeat the code. Alternatively we can use our repeating code
inside a loop.

There are three methods for, while and do-while which we can repeat a part of a

1. while loop

while loop is constructed of a condition or expression and a single command or a block

of commands that must run
in a loop.


block of statement
The statements within the while loop would keep on getting executed till the condition
being tested remains true. When the condition becomes false, the control passes to the
first statement that follows the body of the while loop


#include <stdio.h>
int main ()
int a=10;
printf(“value of a: %d”,a);
return 0;
2. For loop
for loop is something similar to while loop but it is more complex. for loop is
constructed from a control statement that determines how many times the
loop will run and a command section. Command section is either a single
command or a block of commands.

} for(control statement)
for(control statement)
block of statement
Control statement itself has three parts:
for ( initialization; test condition; run every time command )

 Initialization part is performed only once at for loop start. We can

initialize a loop variable here.
 Test condition is the most important part of the loop. Loop will
continue to run if this condition is valid (true). If the condition becomes
invalid (false) then the loop will terminate.
 Run every time command section will be performed in every loop cycle.
We use this part to reach the final condition for terminating the loop. For
example we can increase or decrease loop variable’s value in a way
that after specified number of cycles the loop condition becomes invalid
and for loop can terminate.


#include <stdio.h>
int main ()
int a;
for( a = 10; a < 20; a = a + 1 )
printf("value of a: %d\n", a);
return 0;

3. do-while loop
The while and for loops test the termination condition at the top. By contrast,
the third loop in C, the do-while, tests at the bottom after making each pass
through the loop body; the body is always executed at least once.
The syntax of the do is

while (expression);
The statement is executed, then expression is evaluated. If it is true,
statement is evaluated again, and so on. When the expression becomes false,
the loop terminates. Experience shows that do-while is much less used
than while and for.

A do-whileloop is used to ensure that the statements within the loop are
executed at least once.


int main ()
int a = 10;

printf("value of a: %d", a);
a = a + 1;
while( a < 20 );
return 0;
4. Break and Continue statement
We used break statement in switch case structures in previouslly. We can
also use
"break" statement inside loops to terminate a loop and exit it

while (num<20)
printf("Enter score : ");
Continue statement can be used in loops. Like break
command continue changes flow of a program. It does not terminate the loop
however. It just skips the rest of current iteration of the loop and returns to
starting point of the loop.


#include <stdio.h>
int main ()
int a = 10;
while( a < 20 ) {
printf("value of a: %d", a);
if( a > 15)
return 0;


 Arithmetic Operators

An arithmetic operator performs mathematical operations such as addition,

subtraction and multiplication on numerical values (constants and variables).

Operator Meaning of Operator

+ addition or unary plus

- subtraction or unary minus

* multiplication

/ Division

% remainder after division (modulo division)

 Increment and decrement operators

C programming has two operators increment ++ and decrement -- to change the

value of an operand (constant or variable) by 1.

Increment ++ increases the value by 1 whereas decrement -- decreases the value by 1.

These two operators are unary operators, meaning they only operate on a single

The operators ++ and -- are used as prefix. These two operators can also be used as
postfix like a++ and a--. increment and decrement operators work when used as

 Relational Operators

A relational operator checks the relationship between two operands. If the relation is
true, it returns 1; if the relation is false, it returns value 0.

Relational operators are used in decision making and loops.

Operator Meaning of Operator Example

== Equal to 5 == 3 returns 0

> Greater than 5 > 3 returns 1

< Less than 5 < 3 returns 0

!= Not equal to 5 != 3 returns 1

>= Greater than or equal to 5 >= 3 returns 1

<= Less than or equal to 5 <= 3 return 0

Logical Operators

An expression containing logical operator returns either 0 or 1 depending upon

whether expression results true or false.

Operator Meaning of Operator Example

Logial AND. True only if all If c = 5 and d = 2 then, expression ((c == 5)

operands are true && (d > 5)) equals to 0.

Logical OR. True only if either If c = 5 and d = 2 then, expression ((c == 5)

one operand is true || (d > 5)) equals to 1.

Logical NOT. True only if the If c = 5 then, expression ! (c == 5) equals to

operand is 0 0.
Explanation of logical operator program

 (a == b) && (c > 5) evaluates to 1 because both operands (a == b) and (c > b) is

1 (true).
 (a == b) && (c < b) evaluates to 0 because operand (c < b) is 0 (false).
 (a == b) || (c < b) evaluates to 1 because (a = b) is 1 (true).
 (a != b) || (c < b) evaluates to 0 because both operand (a != b) and (c < b) are
0 (false).
 !(a != b) evaluates to 1 because operand (a != b) is 0 (false). Hence, !(a != b) is 1
 !(a == b) evaluates to 0 because (a == b) is 1 (true). Hence, !(a == b) is 0 (false).

 Bitwise Operators

During computation, mathematical operations like: addition, subtraction, addition and

division are converted to bit-level which makes processing faster and saves power.

Bitwise operators are used in C programming to perform bit-level operations.

Operators Meaning of operators

& Bitwise AND

| Bitwise OR

^ Bitwise exclusive OR

~ Bitwise complement

<< Shift left

>> Shift right

 Conditional Operator Syntax

A conditional operator is a ternary operator, that is, it works on 3 operands.

conditionalExpression ? expression1 : expression2

The conditional operator works as follows:

 The first expression conditionalExpression is evaluated first. This expression evaluates

to 1 if it's true and evaluates to 0 if it's false.
 If conditionalExpression is true, expression1 is evaluated.
 If conditionalExpression is false, expression2 is evaluated.


An array is a collection of data that holds fixed number of values of same type.

float marks[100];

The size and type of arrays cannot be changed after its declaration.

Arrays are of two types:

1. One-dimensional arrays
2. Multidimensional arrays

Declare an array
data type array name [array size];

.Elements of an Array access

You can access elements of an array by indices.

The first element is mark[0], second element is mark[1] and so on.

Points :

 Arrays have 0 as the first index not 1. In this example, mark[0]

 If the size of an array is n, to access the last element, (n-1) index is used. In this
example, mark[4]
 Suppose the starting address of mark[0] is 2120d. Then, the next address, a[1], will be
2124d, address of a[2] will be 2128d and so on. It's because the size of a float is 4
 initialize an array

It's possible to initialize an array during declaration.

int mark[5] = {19,6,10,12,3}


Array of characters is called a string. A string is terminated by a null character /0.

For example:

“c string tutorial “

"c string tutorial" is a string. When, compiler encounter strings, it appends a null
character /0 at the end of string.

Declaration of strings

Strings are declared in a similar manner as arrays. Only difference is that, strings are
of chartype.
Using arrays
Char s[5];

Using pointers

Strings can also be declared using pointer

.char *p;

Initialization of strings

In C, string can be initialized in a number of different ways.

Both initialization and declaration are done in the same step.

Using arrays
Char c[] =”abcd”;
Char c[50] ={ ‘a’, ’b’ , ’c’ , ’d’ , ’\0’ };
Char c[] ={‘a’,’b’,’c’,’d’,’\0’};

The given string is initialized and stored in the form of arrays as above.

Reading Strings from user

The scanf() function to read a string like any other data types.

The scanf() function only takes the first entered word. The function terminates when it
encounters a just space

Reading words from user

char c[20];
scanf("%s", c);

Using scanf() to read a string

Read string from terminal.

#include <stdio.h>
int main()
char name[20];
printf("Enter name: ");
scanf("%s", name);
printf("Your name is %s.", name);
return 0;
Reading a line of text

An approach to reading a full line of text is to read and store each character one by one.

Getchar() to read a line of text

Line of text character by character.

int main()
char name[30], ch;
int i = 0;
printf("Enter name: ");
while(ch != '\n') {
ch = getchar();
name[i] = ch;
name[i] = '\0';
printf("Name: %s", name);
return 0;

Using the function getchar(), ch gets a single character from the user each time.

This process is repeated until the user enters return . Finally, the null character is
inserted at the end to make it a string.

This process to take string is tedious.

standard library function to read a line of text

Line of text using gets() and puts()

There are predefined functions gets() and puts in read

string handling functions in the standard library "string.h".

Used string handling functions are discussed below:

Function Work of Function

strlen() Calculates the length of string

strcpy() Copies a string to another string

strcat() Concatenates(joins) two strings

strcmp() Compares two string

strlwr() Converts string to lowercase

strupr() Converts string to uppercase

Strings handling functions are defined under "string.h" header file.

Data structure

 Sorting
Sorting is nothing but storage of data in sorted order, it can be in ascending or
descending order we need to search, like a particular record in database, roll numbers in
merit list, a particular telephone number, any particular page in a book etc.
Sorting arranges data in a sequence which makes searching easier. Every record which is
going to be sorted will contain one key. Based on the key the record will be sorted. For
example, suppose we have a record of students, every such record will have the following

 Roll No.
 Name
 Age
 Class

Here Student roll no. can be taken as key for sorting the records in ascending or
descending order. Now suppose we have to search a Student with roll no. 15, we don't
need to search the complete record we will simply search between the Students with roll no.
10 to 20.
Types of Sorting Techniques
There are many types of Sorting techniques, differentiated by their efficiency and space
requirements. Following are some sorting techniques which we will be covering in next

1. Bubble Sort
2. Insertion Sort
3. Selection Sort
4. Quick Sort

5. merge sort

Bubble Sorting
Bubble Sort is an algorithm which is used to sort N elements that are given in a
memory for eg: an Array with N number of elements. Bubble Sort compares all the
element one by one and sort them based on their values.
It is called Bubble sort, because with each iteration the largest element in the list
bubbles up towards the last place
Sorting takes place by stepping through all the data items one-by-one in pairs and
comparing adjacent data items and swapping each pair that is out of order.
 Insertion Sorting
It is a simple Sorting algorithm which sorts the array by shifting elements one by one.
Following are some of the important characteristics of Insertion Sort.

1. It has one of the simplest implementation

2. It is efficient for smaller data sets, but very inefficient for larger lists.
3. Insertion Sort is adaptive, that means it reduces its total number of steps if given a
partially sorted list, hence it increases its efficiency.
4. It is better than Selection Sort and Bubble Sort algorithms.
5. Its space complexity is less. Like Bubble Sorting, insertion sort also requires a single
additional memory space.
6. It is a Stable sorting, as it does not change the relative order of elements with equal

 Selection Sorting
Selection sorting is conceptually the most simplest sorting algorithm. This
algorithm first finds the smallest element in the array and exchanges it with the
element in the first position, then find the second smallest element and exchange it
with the element in the second position, and continues in this way until the entire
array is sorted.
Selection sort is an unstable sort it might change the occurrence of two similar
elements in the list while sorting. But it can also be a stable sort when it is implemented
using linked list data structures.
 Quick sorting
Quick sort is a highly efficient sorting algorithm and is based on
partitioning of array of data into smaller arrays. A large array is partitioned
into two arrays one of which holds values smaller than the specified value,
say pivot, based on which the partition is made and another array holds
values greater than the pivot value.

Merge Sort Algorithm

Merge Sort follows the rule of Divide and Conquer. In merge sort the
unsorted list is divided into N sub lists, each having one element, because a list
consisting of one element is always sorted. Then, it repeatedly merges these sub
lists, to produce new sorted sub lists, and in the end, only one sorted list is
Merge Sort is quite fast, and has a time complexity of O(n log n). It is also a stable
sort, which means the "equal" elements are ordered in the same order in the sorted list.
Dynamic Memory Allocation
standard library functions: malloc(), calloc() and realloc()

Declare the size of an array.

Insufficient or more than required to hold data. allocate memory dynamically .

Dynamic memory management refers to manual memory management.To obtain more

memory when required and release it when not necessary.

Inherently does not have any technique to allocate memory dynamically.

there are 4 library function defined under <stdlib.h> for dynamic memory allocation.

Function Use of Function

Malloc() Allocates requested size of bytes and returns a pointer first byte of allocated space

Allocates space for an array elements, initializes to zero and then returns a pointer to

Realloc() Change the size of previously allocated space

Free() deallocate the previously allocated space


The name malloc stands for "memory allocation".

The function malloc() reserves a block of memory of specified size and return a pointer
of type void which can be casted into pointer of any form.

Syntax of malloc()
Ptr =(cast -type*) malloc(byte -size);

ptr is pointer of cast-type. The malloc() function returns a pointer to an area of memory
with size of byte size. If the space is insufficient, allocation fails and returns NULL
Ptr = (int*) malloc(100 * sizeof(int));

This statement will allocate either 200 or 400 according to size of int 2 or 4 bytes
respectively and the pointer points to the address of first byte of memory.


The name calloc stands for "contiguous allocation".

The only difference between malloc() and calloc() is that, malloc() allocates single block
of memory whereas calloc() allocates multiple blocks of memory each of same size and
sets all bytes to zero.

Syntax of calloc()
Ptr = (cast-type*) calloc(n, element -size);

This statement will allocate contiguous space in memory for an array of n elements. For

Ptr = (float*) calloc (25, size of(float));

This statement allocates contiguous space in memory for an array of 25 elements each
of size of float, i.e, 4 bytes.

C realloc()

If the previously allocated memory is insufficient or more than required, you can change
the previously allocated memory size using realloc().

Syntax of realloc()
Ptr = realloc(ptr, newsize);
ptr is reallocated with size of no.


Dynamically allocated memory created with either calloc() or malloc() doesn't get freed
on its own. You must explicitly use free() to release the space.

syntax of free()
frees the space allocated in the memory pointed by ptr.
Linked list

A linked list is a sequence of data structures, which are connected together

via links.

Linked List is a sequence of links which contains items. Each link contains a
connection to another link. Linked list is the second most-used data structure
after array. Following are the important terms to understand the concept of
Linked List.

 Link − Each link of a linked list can store a data called an element.

 Next − Each link of a linked list contains a link to the next link called Next.

 Linked List − A Linked List contains the connection link to the first link called

 Linked List Representation

Linked list can be visualized as a chain of nodes, where every
node points to the next node.

As per the above illustration, following are the important points to be


 Linked List contains a link element called first.

 Each link carries a data field(s) and a link field called next.
 Each link is linked with its next link using its next link.

 Last link carries a link as null to mark the end of the list.

Types of Linked List

Following are the various types of linked list.

 Simple Linked List − Item navigation is forward only.

 Doubly Linked List − Items can be navigated forward and backward.

 Circular Linked List − Last item contains link of the first element as next and
the first element has a link to the last element as previous.

Basic Operations
Following are the basic operations supported by a list.

 Insertion − Adds an element at the beginning of the list.

 Deletion − Deletes an element at the beginning of the list.

 Display − Displays the complete list.

 Search − Searches an element using the given key.

 Delete − Deletes an element using the given key.

File Handling
A file represents a sequence of bytes on the disk where a group of related data is stored.
File is created for permanent storage of data.
Structure pointer of file type to declare a file.
FILE *fr;

Basic file operations.

Function Description

fopen() create a new file or open a existing file

fclose() closes a file

getc() reads a character from a file

putc() writes a character to a file

fscanf() reads a set of data from a file

fprintf() writes a set of data to a file

Opening a File or Creating a File

The fopen() function is used to create a new file or to open an existing file.
General Syntax :
*fp = FILE *fopen(const char *filename, costant *mode);
Filename is the name of the file to be opened and mode specifies the purpose of
opening the file. Mode can be of following types,
*fp is the FILE pointer (FILE *fp), which will hold the reference to the opened(or
created) file.

Mode Description

R opens a text file in reading mode

W opens or create a text file in writing mode.

A opens a text file in append mode

r+ opens a text file in both reading and writing mode

w+ opens a text file in both reading and writing mode

a+ opens a text file in both reading and writing mode

Closing a File
The fclose() function is used to close an already opened file.
General Syntax :
Int fclose( FILE *fp);
fclose() function closes the file and returns zero on success, or EOF if there is an error in
closing the file. This EOF is a constant defined in the header file stdio.h
Input/Output operation on File
In file I/O functions to perform reading and writing on file. getc() and putc() are simplest
functions used to read and write individual characters to a file.
Reading and Writing from File using fprintf() and fscanf()
Create two FILE pointers and both are refering to the same file but in different
modes. fprintf() function directly writes into the file, while fscanf() reads from the file, which
can then be printed on console usinf standard printf() function.
Difference between Append and Write Mode
Write (w) mode and Append (a) mode, while opening a file are almost the same. Both are
used to write in a file. In both the modes, new file is created if it doesn't exists already.
The only difference they have is, when you open a file in the write mode, the file is reset,
resulting in deletion of any data already present in the file. While in append mode this will
not happen. Append mode is used to append or add data to the existing data of file. Hence,
you open a file in Append(a) mode, the cursor is positioned at the end of the present data in
the file.

fseek(), ftell() and rewind() functions

 fseek() - It is used to move the reading control to different positions using fseek
 ftell() - It tells the byte location of current position of cursor in file pointer.
 rewind() - It moves the control to beginning of the file.
Project Based on graphics


Computer Graphics is one of the most powerful and interesting aspect of computers. There are many
things we can do in graphics apart from drawing figures of various shapes Graphics in 16 bit C
programming and M S DOS environment. In a C Program first of all you need to initialize the
graphics drivers on the computer. This is done using the init graph method provided in
graphics.h library.
In graphics.h library in details. Important functions in graphic.h library.
Project work on below :
All video games, animation multimedia predominantly works using computer graphics.
The ”graphics.h” header file in our source program .
GCC compiler doesn’t provides inbuilt facility to run graphics.h library. So you are not
able to run graphics in C language
There is a large number of functions in C which are used for putting pixel on a
graphic screen to form lines, shapes and patterns.
The Default output mode of C language programs is “Text” mode. Graphic” mode
before drawing any graphical shape like line, rectangle, circle etc.

Initializing Graphics Mode

The initgraph function is used to switch the output from text mode to graphics mode
The initgraph function takes three argument
intigraph(&graphics_driver,&graphics_mode,Path _to_driver);

Syntax: – closegraph();
Graphics mode must be closed at the end . For that function closegraph() is used

Some Functions
void line(int x1, int y1, int x2, int y2);
line draws a line from (x1, y1) to (x2, y2) using the current color line() .line function is used to
draw a line from a point(x1,y1) to point(x2,y2)

void circle(int x, int y, int radius);

(x , y) Center point of circle . radius- Radius of circle circle()
Circle function is used to draw a circle with center (x,y) and third parameter
specifies the radius of the circle.
void rectangle(int left, int top, int right, int bottom); rectangle()
Coordinates of left top and right bottom corner are required to draw the rectangle.
void bar( left, top, right, bottom); bar( )
bar function draws a filled-in, rectangular, two-dimensional bar.

void ellipse(int x, int y, int stangle, int endangle, int xradius, int yradius);
ellipse() Ellipse function is used to draw an ellipse , (x,y) are coordinates of center of the ellipse,
stangle is the starting angle,
end angle is the ending angle, and fifth and sixth parameters specifies the X and Y radius of the

Color can be represented using the name of colors in CAPITAL LETTER and also using the numbers
Eg: code 0 means BLACK code 1 means BLUE code 2 means GREEN
 putpixel() and getpixel() ❏ getpixel() returns the color of pixel present at point(x, y) ❏
Syntax– putpixel plots a pixel at a point(x, y) of specified color
 int getpixel(int x, int y); void putpixel(int x, int y, int color);
setbkcolor function changes current background color
e.g. setbkcolor(YELLOW) changes the current background color to YELLOW
that default drawing color is WHITE and background color is BLACK.
void setbkcolor(int color);
setcolor() function changes current drawing color
Example: changes the current drawing color to YELLOW. void setcolor(int color);
Text with Graphics
There are functions in C language that draw text characters in graphics mode. These functions
can be used to mix text and graphics in the same image. These functions also make it possible to
change text font and very the size of text.

Project based on screen saver


Void main()
Int i=0,gd=DETECT,gm,x,y,xx,yy,rad=1;

Figure Title Page

1.1 Lagrangian Droplet Motion ............................................................................................. 70
2.1 Vertical Manifold. ............................................................................................................. 95
3.1 20O Bend Manifold............................................................................................................. 95
3.2 90O Bend Manifold............................................................................................................. 95
4.1 Spiral Manifold ................................................................................................................. 95
4.2 Spiral Manifold Configuration (θ = 225o) ........................................................................ 96
Spiral Manifold with Different Flow Entry Angles (20O, 32.5O and 45O)....................... 96


ATDC After Top Dead Center

BDC Bottom Dead Center
BTDC Before Top Dead Center
CA Crank Angle

Page No.
Acknowledgement i
About Company/industry/institute ii
List of Tables iii
List of Figures iv
List of Abbreviations v
List of Nomenclature vi
Chapter 1: Introduction
1.2 . . . . . . . . . . . . . 8
1.2.1 General 10
1.2.2 . . . . . . . . . . . 12 General 13 . . . . . . . . . . 15 . . . . . . . . . . 16
1.2.3 . . . . . . . . . . . . 17
1.3 . . . . . . . . . . .. . . . . . . 18
1.4 . . . . . . . . . . . . . . . . . . 19
Chapter 2: Project Work 20
2.1 GENERAL 22
2.2 ……………. 23
2.2.1 GENERAL 26
2.2.2 ………… 27
2.3 GENERAL 29
Chapter 3: Result & Discussion. 35

Chapter 4: Conclusion and Future Scope 43

References 59