Académique Documents
Professionnel Documents
Culture Documents
About C Language
( . . . . )
++ .
'C' language:
Easy programing language .'C' language Dennis Ritchie 1970 Bell Telephone
general-purpose
Friend's "
"
"
2.
( ALGORITHM )
(ALGORITHM):
" " ( )
" "
Base
(example:c,c++,java..) Example: Problem Problem1: Number solution: add (a=2 b=3 c=a+b) ?
step1: start step2: step3: step4: step5: step6: IN ENGLISH end (a=2) (b=3) nembers add print / display add add=a+b
step1: start step2: read first number(a=2) step3: read second number(b=3) step4: add above two number i.e add=a+b step5: diplay / print add step6: end : problem1 steps . step1 Slove start End start Problem Ending . start . .
last step(step6)
(find the biggest number from the given two numbrs a=2 b=3) solution:
step4:
end
IN ENGLISH step1: Start step2: Read a=2 step3: Read b=3 step4: if a>b = true then step5: display a is big go to step7
step6: else display b is big step7:end : problem1 step1 start step . start . step2 & step3 numbers a step7 step6
decide end
decide
3.
(FLOW CHAT)
(FLOW CHAT): . (flowgraph) boxes (operation)box symbols . connect algorithm
boxes .
symbols arrow
Arrow connect
figure
Examples
start
. oval
problem1 .
2 & 3 steps
[parallelogram] Ending
(step6)
End
oval
problem 2:
Numbers
a=2 b=3 .
Flow Chat
(find the biggest number from the given two numbrs a=2 b=3)
solution1:
step1 start .
start
. oval
problem1 . step
2 & 3 steps
condition
check
B 6 th steps
CHECK output
4.
Example 1: (1) N Number add
( Examples on Algorithm )
?
solution:
GOTO STEP 5
step5: SUM=SUM+N step 6: N=N-1 GOTO step 4. step7:Display SUM step8: end
IN ENGLISH
step1: start step2:Read N; (N is the value up to we can add) step3:we want add values from 1 to N so take SUM=0; step4:Now we want check condition IF ( N != 0) Then GOTO STEP 5 if else GOTO STEP 7.
step5: SUM=SUM+N step 6: N=N-1 GOTO step 4. step7:Display SUM step8: end : step1 add next 1 value SUM N example N 0 step 5 3!=0 CORRECT SUM N STEP 4 0 2 . start .step2 step 2 N 0 add 1 step 7 now Step 4 NEXT STEP SUM ( N =3-1) . STEP4 CONDITION start . problem problem1 1 value N .NEXT STEP . .
N =3 3
GOTO STEP 4
PERFORM 0 AYE
LOOPING N =0 step 7
Dispaly
5.
Example 1: (1) N Number
Examples on Flowchart
add ?
: step1 add next 1 value SUM N 0 step 5 start .step2 step 2 N 0 add 1 Arrow step 7 start . problem problem 1 value N .NEXT STEP . .
example N
N =3 3
3 ( SUM=0+3).
N Arrow
STEP4
LOOPING N =0
SUM
6..
C Language . ) . . ( key )
( C language Introduction )
data
(or ) .
) (
( data )
Language's 1.
0 ( . , . :
programs
, Registers
Machine level
programs computer
/ . language
programs (C , C++, .
JAVA ... )
Program .
"C"
Level Program .
Low
FileName .Obj
Create
. File
Program
Folder
Program
Output
Ctrl+F9
Press
Output
7.
Programming language
First Program In C
Program C Language .
#include < stdio.h > void main() { printf(" Hello world "); } Starting step "start " main(). printf(" hello world "); Use } use . .
STEP3 End
Examples On printf :
output
output
output
include
#include
program
"
ALT+F9 Errors Press 0 . .
program program
compile
compilation
ERRORS
Error's
Output
output
pro1
ok
. Picture
PROGRAM
compile .
Execute
output
. output
pro2
Hello world
First Hello world Output. Output program Output Program Output. . clear Hello world
previous program output " clrscr() " statement clear screen . meaning
clrscr() -------->
program
Include
program "
statement
Ending Bracket
getch () ------>
Get character .
meaning
Output Screen
key press
program
Include
Final
Program
#include < stdio.h > #include < conio.h > void main() { clrscr(); printf(" Hello world "); getch(); }
output ......
output
8.
Rules .
C Programing Rules
English " C " Language Grammer
Rules
C Language Rules :
1.
"C"
Progarm
Starting
point
main()
Function
Note: main()
#include Functions
( Work
program
Only . : printf("");
.( English )
3.
semicolon .
main() Function
ea statements ina
4.
main() Function
5. Example:
Program program1.c
filename
.(dot)c
save
-----------------9.Printf
#include<stdio.h> #include<conio.h>
printf statement ..
output
same ...
..
Printf Statement
\n --
(New Line )
output
1st printf
( \n )
printf statement
\n ( New Line )
new line
output
output
..
\n
. \n ( New Line )
\n ( New Line )
Examples Printf
#include<stdio.h> #include<conio.h> void main() { clrscr(); printf("name=sivanaadh baazi"); printf("age=22"); printf("gender=male"); printf("father name=satyanarayana"); printf("mother name= malleswari"); printf("qualification=BTech");
getch(); }
output:
Output
name=sivanaadh baazi age=22 gender=male father name=satyanarayana mother name=malleswari qualification=BTech \n ( New line ) .
clrscr();
printf("name=sivanaadh baazi \n"); printf("age=22"); printf("gender=male \n "); printf("father name=satyanarayana"); printf("mother name= malleswari \n"); printf("qualification=BTech"); getch(); }
New line ( \n )
printf statement
New Line
...............
:) :) :)
10.Printf
Character
continue
Escape Sequence
\n \t
Vertical tab Backspace Carriage return Alert Backslash Question mark Single quotation mark Double quotation mark
printf . .
\v \b \r \a \\ \? \' \"
\n
.. \n
Escape Sequence
table
Horizontal Tab ( \t ) :
. printf \t \n (space ) .
Output :