Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Programming.pptx
1. GOVT.D.B. GIRLS P.G.(AUTONOMUS) COLLAGE RAIPUR (C.G.)
Presentation on - Program writing
DEPARTMENT OF PHYSICS
M.Sc.1st Semester 2022
Guided By Presentation By
Miss. Jharna sahane Sonali Sahu
3. C language
It is high level language
Developed by Dennis Ritchie in 1970s
Used For system programming as well as application
programming
Programs written in C are fast and efficient
Supports a variety of data types and powerful operations
There are 32 keywords which are easy to learn and use
It has many built in functions
4. C program Structure
A C Program contains the following –
a) Preprocessor Commands
b) Main( ) function
c) Input and output functions
For Example:
# include <studio.h> /*Comment*/
int z;
int main (void)
{
print f (Hellon”);
print f (welcome to M.Sc. 1st year CE!n”);
return 0;
}
Main
function
begin
Flag success
to operating
system
end
Tells compiler about standard input and output function (i.e. printf+others)
5. C Program structure Explained
1. #include –The first lines are preprocessor commands that tell the
complier that the program is using function in it.
2. Void main ( ) – This is the main function . Program execution beings
with the this function only.
3. Variables- variables hold input and output values.
4. print ( ) – this is function to give output on the screen .The word
“hello” is displayed on output screen.
5. The getch ( ) – It is a function that ends program and returns to
program window.
6. C Programming – Syntax for writing programs
1. C language is case sensitive language . Hello and hello are
two different words.
2. Programs are written in small caps only ie.. In small letters.
Capital words are treated differently.
3. Inside the main( ) function,each statement is terminated
with semicolon.
4. Comments are used for explanation ./*……………*/ formate is
used to give comments in program. They are not executed.
7. C Tokens:
S tokens are the basic buildings blocks in C language which are
constructed together to write a C program.
Each and every smallest individual units in a C program are known as C
tokens.
C tokens are of six types. They are,
Keywords (eg: int ,while),
Identifiers (eg: main ,total),
Constants (eg:10,20),
Strings (eg: “total”, “hello”),
Special symbols (eg: (),{}),
Operators (eg:+,/,-,*)
8. C tokens Example Program:
int main( )
{
int x,y,total;
x=10, y=20;
total=x+y;
Printf (“Total =%d n”,total);
}
where,
main- identifier
{,},(,) – delimiter
int – keyword
x,y, total – identifier
+ - Operators
main,{,},(,), int ,x,y, total,+ - tokens