Professional Documents
Culture Documents
REPORT ON-
A report submitted in partial fulfilment of the requirements for the Award of Degree of
1
ABSTRACT
2
TABLE OF CONTENTS
CONTENTS PAGE NO
Institute Description 6
Methodology 7
Introduction 8
What is C? 10
Features of C
Fundamentals of C
Data Types
Library Functions
Operators and Expressions
Statements
Looping
Functions
Recursion
Array
Overview of Matlab 24
Overview of Latex 27
Conclusion 30
References 31
3
INSTITUTE DESCRIPTION
4
METHODOLOGY
This study report discusses about the use of various software applications like
C-programming, MATLAB, Latex, etc. This study was conducted with the help
of university professors and teaching staff with the help of modern computers.
This programme provided us prolonged and tailored help to understand, learn
and implement the use of these softwares in real world. My colleagues and I
allocated ourselves in a well-recognised Computer Institute for a crash course
with a duration of one month.
Our group learned these Programming languages from the rock bottom to a
notably well state. We were not only taught to write a programme but also to
implement it sideways. As an engineering student, programming softwares are
the backbone for each. All these learning and studying of theories makes no
sense if we can’t implement them in our real world. Implementing requires
simulation, and this is where these softwares are top most necessary.
5
INTRODUCTION TO COMPUTER APPLICATIONS
In the present context, computers are everywhere and we find their
applications in various fields especially in the places where computations are
required and need to be done at a very fast speed.
EDUCATION.
TRAINING.
ENGINEERING.
SCIENCE AND RESEARCH.
ENTERTAINMENT.
6
LaTeX is a software system for document preparation. When writing, the
writer uses plain text as opposed to the formatted text found in
WYSIWYG word processors like Microsoft Word, LibreOffice Writer
and Apple Pages.
7
WHAT IS C?
The C programming language was developed at Bell laboratories by Dennis
Ritchie during the early 97. It was derived from a computer language named B
and from an earlier language BCPL (Basic Combined Programming Language).
Initially it is defined as a system programming language under UNIX.
FEATURES OF C:
Portable.
Less lines of code.
Procedural Programming.
Middle Level Language.
Popular choices for system level apps.
Wide variety of built in functions, standard libraries and header files.
C FUNDAMENTALS
CHARACTERISTICS: C used the uppercase letters A-Z and lowercase letters
a-z and the digits 0-9 and some special characters as building block to form a
basic programming language i.e constant, variables, generator and expression.
IDENTIFIERS: They are the names given to various program elements such as
variable, function and array. Identifier consists of letters; digit in any order
except first character must be letter. Uppercase and lowercase letters both are
permitable. But they are not interchangeable. But we favour lowercase letter.
Undercase character can also be included and consider as a letter.
8
KEYWORD: There are certain reserved words for keywords that have standard
pre-defined meaning in C. This keyword can be used only for their intended
purpose. They cannot be used as programmer defined identifier. For eg: break,
case, char, continue, auto, default, do, double, else, float, for, go to, if, int, long,
return, short, struct, void, switch, while, etc.
DATA TYPE: C supports several different types of data each of which may be
represented differently within the computer memory. The basic data types are
listed below:
LIBRARY FUNCTIONS:
The C language is accompanied by a number of library functions that carry
various operations and calculations. In C to use this library function it may be
necessary to include certain specific information within the main portion of the
program. This information is generally stored in special files which are supplied
with the compiler. Thus, the required information can be obtained simply by
accessing these files. This is accomplished with the pre-processor directive
statements #include i.e
#include <filename>
9
where filename represents the special files. The name of this special files are
specified by each individual implementation of C. The certainly used common
file names are:
Input data can enter into the computer from a standard input device by means of
C library function “scanf”. The general form of the “scanf” function is
The control string consists of individual group of character with one character
group for each input data item. Each character boot must begin with a “%”
followed by a conversion character. The most frequently used conversion
characters are:
CHARACTER MEANING
C Single character
D Decimal integer
S string
10
The argument are written as variable or array whose type match the
corresponding character group in the control string. Each variable name must be
predicted by ‘&’ percent.
Output data can be written from the computer on a standard output device using
the library function printf. The general form of this function is:
where, “control string” refer to the string that contain formatting information
and arg1, arg2, argn are argument that represents the individual output data
item. The control string consists of individual group of characters with one
character group for such output data item. Each character group must begin with
a ‘%’ sign followed by conversion characters. Incontrast to the scanf functions
arguments in the printf function doesnot represent memory address. Therefore,
arguments are not provided by ‘&’.
printf(“%d%f%c”, a,b,c);
C include a large no of operator which falls into several different categories, the
data that the operator acts upon are called operant. Some operator requires two
operands while other act upon only one operant. And some operator in C acts
upon 3 operands.
BINARY OPERATOR:-
11
OPERATOR MEANING
“+” ADDITION
“-” SUBSTRACTION
“*” MULTIPLICATION
“/” DIVISION
“%” MODULUS
RELATION OPERATOR:-
<
<=
>
>=
Here closely related with the relation operator there are 2 equality operator.
= = (EQUAL TO)
! = (NOT EQUAL TO)
&& (AND)
|| (OR)
12
ASSIGNMENT OPERATOR:-There are several different assignment operator
in C but the most commonly used assignment operator is “=”. In addition to this
equal operator. C contains another 5 Assignment operator.
+=
- =
*=
/ =
%=
{C = a > b? a + b: b – a.}
SYMBOLIC CONSTANT:-
Symbolic constants may defined by writing #define name value. Names are
generally written in uppercase letter. If the program requires pi value then we
can define by
13
(# define Pi 3.14159).
CONTROL STATEMENT:-
In most of the C programme instruction are exhibited in the same order in which
they appear within the program. The program of this type is unrealistically
simple. Since they don’t include any logically control structure.
A realistic C program may require that a logical phase be carried out at some
particular point within the program. One of several possible actions will then be
carried out depending on the outcomes of the logical case. This is known as
BRANCHING. In addition the program may require that a group of instructions
be executed rapidly until some logical conditions has been satisfied this called
as looping.
All of this operation can be carried out using the various operation statements in
C.
BRANCHING:-
The if – else statement is used to carry out a logical case and then take one of
the two possible actions depending upon the outcome of the case whether it’s
true/false.
The else portion of if/ else statement is optional thus the simplest general form
is:-
If(condition)
Statement;
14
Where the condition must place in parenthesis. In this form statement will be
expected only if the expression has a non-zero value i.e if the expression is true
otherwise it is ignored.
if (condition)
Statement 1;
else
Statement 2;
BREAK STATEMENT:-
The break statement is used to terminate loop or to exit from a switch. It can be
used within for loop, while loop or switch. Break statement is written simply as
break.
CONTINUE STATEMENT:-
The continue statement is used to bypass the remainder of the current pass. A
continue statement can be used within while loop , do-while loop or for
statement.
LOOPING:-
15
{
Statements;
}
The statements will be executed repeatedly as long as the expression
is true. The statement can be simple or compound though it is usually
a compound statement.
DO – WHILE LOOP:-
When a loop is constructed using the while statement. The test for
continuation of the loop is carried out at the beginning of its path,
Sometime however it is desirable to have a loop with the test for
continuation at the end of each pass. This can be accomplished by
means of do- while statement. The general form of Do while
statement is
do{
Statements;
}
while(condition);
Here the statement will be exhibited rapidly as long as the value of the condition
is true i.e. non zero. The statement can be either be simple or
compound .Though most of the application will required to be a compound
statement.
FOR LOOP:-
16
The for statement is the third and perhaps the most common loop statement in c.
The statement include an expression that specifies an initial value of an index ,
another expression that determines whether or not the loop is continued and
third expression that allows the index to be modified at the of its pass.
FUNCTIONS
A function is a self-content program segment that carries out some specific well
defined tasks. Every C program consists of one or more function. One of this
must be called main. If a program contains multiple functions their definition
may appear in any order. Though they must be independent of one another i.e.
one function definition cannot be embedded within another.
DEFINING A FUNCTION:
A function definition has two principle components. The first line includes the
argument declaration and body of the function. The first line of a function
definition contains the type specification of the value return by the function
followed by the function name and optionally a set of argument. A set of
17
arguments separated by commas and enclosed in parenthesis. The general form
of the first line is:
where data type represents the data type of the item return by the function.
Name represents the function name and type1, type2…....typen represent the
data types of the argument and arg1, arg2………….,argn are the argument.
FUNCTION PROTOTYPE:
The programmer defined function has always preceeded main. Thus when this
program are compiled the programmer defined function has been defined before
the first function access. However many programmer prefer the top down
approach in which main ahead of the programmer defined function.
In such situation the function access will precede the function definition. This
can be confusing to the compiler unless the compiler is fast alerted to the fact
that the function in access will define later in the program. A function prototype
is used for this purpose. The general form of function prototype is:
void main()
RECURSION
18
useful to solve many mathematical problems, such as calculating the factorial of
a number, generating Fibonacci series, etc.
Syntax:
recursive_function()
if base_case = true;
return;
else
return code_for_recursion;
The recursive function or method has two main parts in its body, i.e., the base
case and the recursive case. While the recursive method is executed, first, the
base case is checked by the program. If it turns out true, the function returns and
quits; otherwise, the recursive case is executed. Inside the recursive case, we
have a recursive call that calls the function inside which it is present.
Advantages of recursion
Disadvantages of recursion
19
Recursive functions are generally slower than non-recursive function.
It may require a lot of memory space to hold intermediate results on the
system stacks
It is not more efficient in terms of space and time complexity.
ARRAY
In C many applications required the processing of multiple data item that have
common characteristics. In such situation it is often convenient to place the data
items into an array where they will share the same name. The individual data
items can be characters, integers, floating point integers etc. However, they
must all be the same type and the same storage class. Each array element is
referred to by specifying the array name followed by one or more subscript with
each subscript enclosed in square bracket. Each subscript must be expressed as
an non negative integer in a n element array.
x[0],x[1],x[2],………………………x[n-1]
20
Array in C programming language is a collection of fixed size data belongings
to the same data type. An array is a data structure which can store a number of
variables of same data type in sequence. These similar elements could be of
type int, float, double, char etc.
Advantage of Arrays in C:
Array is Static Data Structure. We cannot change the size of array in run-
time.
We must know in advance that how many elements are to be stored in
array.
Only elements of same data types can be stored in an array. We cannot
store elements of multiple data types in a single array.
21
MATLAB
Introduction: It is a software package for high performance numerical
computation and visualization. It provides an interactive environment with
hundreds of building functions fop technical computation, graphics and
animation. It also provides easy extensibility with its own high level
programming language. The name of MATLAB stands for "matrix laboratory".
File types: MATLAB can read and write several types of files. However, there
are mainly five different types of files for storing the data on programs. M-file
standard ASCIL text file with a top M-extension.
22
There are two types of this file: 1) Script file
2) Function file
Most programs to write in MATLAB are saved in M-files. All build in function
in MATLAB are in files.
MAT file: MAT files are binary data files with a dot(.)-MAT extension MAT-
file are created by MATLAB when we save data with save command.
Fig file: Fig files are binary files with dot fig extension. That can be open again
in MATLAB as figure.
P-file: P-files are compiled M-files with a dot(.) P extension. That can be
executed MATLAB directly.
MEX-file: MEX files are MATLAB Fortran turn, C and Java program with a
dot(.) MEX extension to the file name.
23
Numbers in MATLAB:
i) Integers
ii) Real
Integers are extended without decimal point and numbers with decimal point are
known as real number. Variables realmin and realmax denotes the smallest and
the largest positive real number in MATLAB. Complex number in MATLAB.
Complex number in MATLAB is represented in rectangular form. The
i = 0 + 1.000 i
-Inf
Inf
NaN
There are IEEE representations of negative and positive infinity. Na stands for
not a number. Saving and loading our works. All variables used in current
MATLAB session are saved in a work space. We can view the content of the
file workspace by clicking on file in the tool bar next selecting show workspace
or we can also check the content of the workspace by typing ‘Whos’ in the
command window.
24
INTRODUCTION TO LATEX
The generally used documents such as project reports, notices, internal notes
etc. in any technical institute are expected to be submitted in a standard
specified format. The commonly used editing tools for this purpose are
Microsoft Word, notepad, wordpad, etc.
Taking into consideration various formatting constraints namely alignment, font
styles, paragraphs, sections, subsections, etc. becomes a bit tedious using MS
Word or other tools. Also maintaining the subscripts and superscripts to obtain
the various mathematical equations becomes difficult and time consuming.
To overcome this drawback we have LATEX, a documentation preparation
system that enables the document writer to concentrate on the contents of their
text, without bothering too much about the formatting of it.
An Introduction to Latex
LATEX is a document preparation system for high-quality typesetting. It is
most often used for medium-to-large technical or scientific documents but it can
be used for almost any form of publishing.
LATEX is not a word processor. LATEX is based on the idea that authors
should be able to focus on the content of what they are writing without being
distracted by its visual presentation. In preparing a LATEX document, the
author specifies the logical structure and lets the LATEX system worry about
the presentation of these structures. It therefore encourages the separation of
layout from content while still allowing manual typesetting adjustments where
needed.
LATEX is based on Donald E. Knuth’s TEX typesetting language or certain
extensions. LATEX was first developed in 1985 by Leslie Lamport.
WHY LATEX?
25
What you see is what you get (WYSIWYG) programs make it easy to put text
wherever you want in whatever size and style of type you want, i.e.,
WYSIWYG programs offer visual design.
The visual design is fine for short, simple documents like letters and memos.
The visual design is not good for more complex documents such as scientific
papers. For this purpose, we use LATEX that offers logical design.
LATEX is intended to provide a high-level language that accesses the power of
TEX. LATEX comprises a collection of TEX macros and a program to process
LATEX documents. Because the TEX formatting commands are very low-level,
it is usually much simpler for End-users to use LATEX.
As LATEX is distributed under the terms of the LATEX Project Public License
(LPPL), LATEX is free software.
26
The command requires two arguments: the name of the command you want to
create, and the definition of the command. The num argument in square
brackets is optional.
27
CONCLUSION
28
REFERENCES
29