Sie sind auf Seite 1von 28

1.

About C Language
( . . . . )

++ .

'C' language:

Friends 'C' language language

Easy programing language .'C' language Dennis Ritchie 1970 Bell Telephone

general-purpose

Friend's "

'C' language (flowchart)"

"

"

2.

( ALGORITHM )
(ALGORITHM):

" " ( )

" "

programing language (algorithm) (algorithm) (algorithm) .

Base

Language Programining language

(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)

problem 2: Numbers a=2 b=3

(find the biggest number from the given two numbrs a=2 b=3) solution:

step1: Start step2: step3: a=2 b=3

step4:

a>b a b print print

step5: correct step6: correct step7:

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

Reading numbers. a>b . correct . . a>b correct b

next step5 step6 step5

decide end

decide

3.

(FLOW CHAT)
(FLOW CHAT): . (flowgraph) boxes (operation)box symbols . connect algorithm

boxes .

symbols arrow

Arrow connect

figure

symbols and boxes

(flow chat ) Example: Problem 1: Number Flow Chat add

Examples

(a=2 b=3 c=a+b) ?

(Draw a Flow Chat Diagram For Addition Of Two Numbers) solution1:

step1 start values . .

start

. oval

problem1 .

2 & 3 steps

[parallelogram] addition . start perform 5 th steps output

4 step [Rectangle] print . . last step

[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

values input [parallelogram] . A 4

condition

check

B 6 th steps

CHECK output

Diamond print . . oval

[parallelogram] start End Ending

last step (step7)

4.
Example 1: (1) N Number add

( Examples on Algorithm )
?

(write an algorith for adding number from 1 to N?)

solution:

step1: start step2: step3: step4: add add SUM=0 IF ( N != 0) N

CONDITION CHECK GOTO STEP 7.

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

condition N!=0 check SUM=SUM+N 3 ( SUM=0+3).

PERFORM STEP 6 N=N-1

GOTO STEP 4

CHECK STEP 6 SUM

NEXT STEP STEP 4 VALUE N

PERFORM 0 AYE

LOOPING N =0 step 7

Dispaly

5.
Example 1: (1) N Number

Examples on Flowchart
add ?

(write an algorith for adding number from 1 to N?) Solution :

: 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!=0 CORRECT SUM

now Step 4 Arrow 0

condition N!=0 check NEXT STEP SUM=SUM+N

PERFORM STEP 6 N=N-1

SUM 2 ( N =3-1) . STEP 4 . 0 Dispaly

3 ( SUM=0+3).

N Arrow

GOTO STEP 4 CHECK STEP 6 Arrow step 7 NEXT STEP Arrow

STEP4

PERFORM STEP 4 N VALUE

LOOPING N =0

SUM

6..
C Language . ) . . ( key )

( C language Introduction )
data

(or ) .

) (

( data )

(Memory location Address ) access 3 : . 0, 1 . .

Language's 1.

Low Level Language: ), 1 ( ) . . 0 , 1

0 ( . , . :

Low Level Language

0001 0111 0100 Low Level Language 2. .

Middle Level Language : Middle level languages

programs

MOV ADD SUB DIV Direct


language computer 3. High level language : High level language GENERAL languages High Low Compiler/ Interpreter . low level . computer . . computer programming .

, Registers
Machine level

programs computer

/ . language

programs (C , C++, .

JAVA ... )

( MACHINE LEVEL LANGUAGE / LOW LEVEL LANGUAGE/ BINARY LEVEL LANGUAGE ) .

"C" Language Low level

Program .

High Level Language

"C"

Language Compiler ALT+F9 Press

Program . Compiler Low Level

High Low level

Level Program .

Low

Level . Program Extra . File

FileName .Obj

Create

. File

Program

Folder

Program

Output

Ctrl+F9

Press

Output

7.
Programming language

First Program In C
Program C Language .

Write a Algorithm To print a message "HELLO WORLD "?

STEP1: Start Step2: print HELLOWORLD

STEP3: END Same

"C " Write a Program to print Hello world message At output ?

#include < stdio.h > void main() { printf(" Hello world "); } Starting step "start " main(). printf(" hello world "); Use } use . .

"C " Language

Stating Step Void "C " Language Ending

STEP2 print HELLO WORLD

STEP3 End

printf syntax: printf (" 's output ");

Examples On printf :

printf(" hai ") ; -----------------> hai

output

printf(" siva naadh baazi is great "); --------------------> sivanaadh baazi is

output

printf("your name");----------------------> your name

output

" Printf work

printf void main()

program already stdio.h file Include printf program

include

#include

program

"
ALT+F9 Errors Press 0 . .

program program

compile

compilation

ERRORS

Error's

compilation CTRL+F9 PRESS

Output Output . Output

Output

CTRL+F9 press Program . picture OUTPUT Output

OUTPUT ALT+F5 press

output

pro1

ok

. Picture

PROGRAM

compile .

Execute

output

. output

pro2

OUTPUT Program . Output

Hello world Hello world printf .

print

. output print program print

Hello world

First Hello world Output. Output program Output Program Output. . clear Hello world

present program output .

previous program output " clrscr() " statement clear screen . meaning

clrscr() -------->

clrscr() work conio.h " . Ctrl+F9 Press . Output screen

program

Include

program "

Output Ctrl+f9 press

output Screen " getch () "

statement

Ending Bracket

getch () ------>

Get character .

meaning

Output Screen

key press

getch () ------> work program " conio.h " .

program

Include

Final

Program

#include < stdio.h > #include < conio.h > void main() { clrscr(); printf(" Hello world "); getch(); }

output ......

output

print

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("");

Example program Stdio.h stdio.h


2.

vundhi printf work main() END

include main() function sentence End

program Starting Point statement SEMI COLON ; full stop .

.( English )
3.

semicolon .

main() Function

Begining Bracket and Ending Bracket . #include statements Header files

ea statements ina
4.

main() Function

5. Example:

Program program1.c

filename

.(dot)c

save

pro.c abcdfeg.c 6. Progarm Run Complie CTRL+ ( Output ) ALT+F9

-----------------9.Printf

Write A Program To Print Your Name and Age At Output

#include<stdio.h> #include<conio.h>

void main() { clrscr();

printf("sivanaadh baazi"); printf("22"); getch(); }

output sivanaadhbaazi 22 output output . output

printf statement ..

#include<stdio.h> #include<conio.h> void main() { clrscr(); printf("sivanaadh baazi 22"); getch(); }

output

same ...

..

" C Language "

Printf Statement

\n --

(New Line )

Write A program To print Your Name And Age Line By Line..

\n (New line) Statement

1st printf Statement

output

1st printf

( \n )

printf statement

\n ( New Line )

new line

output

output

..

\n

. \n ( New Line )

printf statement output ..............

\n ( New Line )

Examples Printf

Write a Program To print U R Bio-Data at output

#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 ) .

#include<stdio.h> #include<conio.h> void main() {

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 )

1,3,5 printf statements

Ouput: name=sivanaadh baazi age=22 gender=male father name=satyanarayana mothername=malleswari qualification=BTech

printf statement

New Line

...............

:) :) :)

10.Printf
Character

continue
Escape Sequence

Newline Horizontal tab

\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 ) .

Program on Horizontal Tab :

Output :

C Language Show videos in youtube link: http://www.youtube.com/watch?v=RPJx7mCYXzU&playnext=1&list=PLA8E0AD777C0B9827&feature=re sults_main

Das könnte Ihnen auch gefallen