Open navigation menu
Close suggestions
Search
Search
en
Change Language
Upload
Sign in
Sign in
Download free for days
0 ratings
0% found this document useful (0 votes)
39 views
C Programming Notes Part 2
c programming notes mechanical engineering semester 1 part 2
Uploaded by
Farhan Masud
AI-enhanced title
Copyright
© © All Rights Reserved
Available Formats
Download as PDF or read online on Scribd
Download now
Download
Save C-Programming-Notes-Part-2 For Later
Download
Save
Save C-Programming-Notes-Part-2 For Later
0%
0% found this document useful, undefined
0%
, undefined
Embed
Share
Print
Report
0 ratings
0% found this document useful (0 votes)
39 views
C Programming Notes Part 2
c programming notes mechanical engineering semester 1 part 2
Uploaded by
Farhan Masud
AI-enhanced title
Copyright
© © All Rights Reserved
Available Formats
Download as PDF or read online on Scribd
Download now
Download
Save C-Programming-Notes-Part-2 For Later
Carousel Previous
Carousel Next
Save
Save C-Programming-Notes-Part-2 For Later
0%
0% found this document useful, undefined
0%
, undefined
Embed
Share
Print
Report
Download now
Download
You are on page 1
/ 24
Search
Fullscreen
Types of logical openators:- logical AND logical oR — logical NoT '@ gb &Reca) Jot Cnot zero) 1231150 TN’ 21 (Asctt no. Value) =o Jo-3 Jogen G d-ge 1-1-1 JE Ci¢a) =" Crotigy = War=lo=4 Logical spereatore. (ns) 8 & => In case of logical and, if and only &f both the operands tperrators ane true, then the Value of the expression is Hrue (0) or else it is false ¢ p.eh=‘N’ int x2t,y=2, 273 a xhSyet SGRR2) 223 =(1 201) £83 a1 R23 ney &Ry>D"O Va a Pe 21%81 1 =t = (ga) & 8 &>2) =1a60 =o Logical of (0 =D In case of Logical of, if the first operand \o 1, than 1+ wil) not work with the second eperater opetrand. IE will Gost give output t.1F the 4° operand is 0, then if wilh work with the second operand. a Wy &&L—staieh freom left! Tuy Yybr ei a2 22 ro RBA «OUT RHR 1 2/@Ba = 1822 2X22 =O KER ry eT RQ al =o 21 =4sin oli, AND oR pay 1 bo | 0 © 1 ° | oO 0G 0 6 ° ° int x= O,y 0,250; int azo, b=0,cr 05 Printé C" & <2 8G =o) &8Q=3)2 %d\n", cua) 82 RE ys 223 i G2) RE @ =3);) print} C" x= “dy Kaz has" wy2)5 X=, ¥r 0,220 *|primt$ ("@ a1) RZ bX R(era)=%d” Get) RELKA Cees) asl, b= 0, to printf C"@ Abed, cr % db") asbedy HRE01Y20, 270 print C' Xx I MGra) N29 Za" GeDNG=ayN@-a))5 xe by yro, 270 puntf CO" x= *dys Ad e224" wy2)5_** Assignment Operators — op=exp. an = ty! aa opeenp a ean Ca ty-10) at =Qry-10) @+4+=10, 2=a410 a=at(xty-to) Q-=10, a> a-I0 iz =10 i = tT Increment Operator (++, --) amen Ope kee ttm > memal int a,b wag, oemeder’ a= b+105 atts -- m3 mem-4 3 msm25-08-2019 do { printf (“|nput number "} number = getnumber C); |} | while Cnumber So); sum=sum4 5 | whie Covmy Goll sum digg) a) => Do statement execuks at least| Loops'~ NESTING while, do, if, else AP-IBUSE fees flow chant of if statement: (Enter) has, / test - Ente AS, [ase | ® —1 (Te) (if staterrent) | Thue |. se } if etse Aone | atecoei hack if Ctest expressson) | ia | - ta . stat | 3 fae statements) von — __I 3 else £ false statement ; 3 | ig Cord t= 0) | Grater (float) Cath) tock) (ers); printf C"saho= AF NN ", vako), } else Spek printf ("esd =oNn ");nesting if else Nesting if else if Chee) : if Clea) if Ctest condition) f / {if fest c-3) le if (lest condin on=2) ties} else | {At Gest condihon-3) Gatat ty {stats 3} 3 else else Lstatead ee | : | etse es stat: 54 3 else tstat:e}Nesting if ebse flow thant + if Cpersen is female) Lif Cvolence >100000 bonus= 605 balances, else bonus>' 0:0) botance 5 3 else } bonvs = 0-024 balance, ja4 Wf (person is female) ey . dangling ef if-else. If (balance > to0d000) bonu 05 & balance ; tise bonus = o:oQH balance | balance =balance + bonus; | angling else if aelse if ladder if Ccond=1) st-15 else if Ceond-a) St-25 else if Ccond-3) \ evse if st-3; ladder, | else if (cond-n) | stn; Weise | no longes SF, becavse no further the end. conditiins ave there at0-100 > At To- 745A 60-40 38 40-4 FD #H include
int man () { Ink mark 4 printf (“Entec a grade: "); scanf ("Ad") Bmarkds if Crnark <= 100 22 mayicS= 0) PTINkf C" Gyade ADS else if (mark £94 b% mask>= 70) printf C" Gade nD) else if (mark <= 702% mark >= 60) printf (" @rade B")5 else af (mark 2-59 &B Mark P= 50) printe(" grade 0" cise if (mark C247 RR mAek 7 49) prin f C’@rode 0 ")5 else fprintf C" Fait "))} Vehin 6
~ ] es) (s32] | for Cinihaligzations con dition, increment /decvement ) | 1. body of the l0oP if | write the same 3 statement with while Loop:~ Jae > increment part int x= 4) white (x >) y prints Cad An's, Hd for (x= Q5 x05 ERE newts | L printf Choad) WO, % ———— WITH Do WHILE i--— decrement part printf C\n")5 *=4 do g pvintt ("Za \P"> w°, | weutd while Cryo)sum=05 ce Cn=1y n20 && sumcioo s444i3 1D togica epenaty can also be used as @ Condihon. t 3 Jo n=0, sifthe value of Hhe Variable ox jneaay js declabed earlier, Initialization, {nena con be emply \ if incr. /decr. js stated eoly, || i+ can be empiy- l| + bu the bods—ef the Loop Most contain semi colon “Semicolon MvsT be there im for Voor 717 SEE EXAMPLES OF POR ip EFRON scHAUN SERIESSwitch STATEMENT aL —— _Carorks like else if ladder ) switch (expression) || case value-I: ‘blank-15 | brealcs general | case value-a blank-3} syntax of | break: swileh ofate ment- | defautt: defavlt block; | break§; J} st-Kyz;08/04/2019 Enivy expression- 4 cs block 1 aaa exeression-alyi ony 2 ona) oe x pression-3 block 3 [| +? stot v Index=mark/{0; 5wi teh (inde x) a [case 10% case 4 tose &% } grades “As 5 break; Cast Fi case 6+ grades“ O+'5 be break;case oS. grade= C4’, |. te |case 4 | grade = «p's | breaks, (tose ‘default || Grade = “¢giy) break; , prints CN, s.\n ” | , | R for loop’ grade); used to cheek the atrade of many students *+ im one program, | Go to Statement | ~ So Aaeee | place, > G0 1 Statement requines « label to identify the ‘plone | where the branch is to be -tsed made, Jt, (abel is a mame ané must be fottowed by a colon. |The labe) ‘> placed immediately before he statement | | Whede the contizol is to be tteansfermed,=> label can be before the go fo statement then it is Fcatied back ward jump. Again,label can be aftes the go to statement then 3 is called forward sump. forward ea ke wand | to |label |? bas | got [tab & | labels [stetemen}_blocls statement diock CD) (labels go to label. state ment block | i } CODE CIN FINITE Loos) int main ©) | double 4 5 || read: | scant (AE RW; | (x 68) yebectwons ge fe reads Y get=sqrt Cx) PALER, prime ZbA0", Gu) {go te read |~ 5 this go te read at the end will I} cause the progam to yun confinvossiy, |Pare while) ise) as elbane’ Ren the! ahi: Ail Crag as) loop breaks, ao . tor C9 Lifer () bie (cond: break; while C) i VF Cersor) 90 to step; if Condition) ° go to abe;for ¢ ) t by COR aa | Lit Condition) [ae te enon } | } errors just like breke Lbyeak , continue is also a statement. For continoe, program will conhnve7 es RS s ce [Area ] SS OT ee ae of data, = * Access values with huge volul Ariay Il ed collection of “PAN avvay is a fixed sized sequenc j 1 || Slements of the same data types. I 18 simply a | SRrouping of Tike type data. $n is used || to express a list of Mumbers, list of Products, Array [ “Ul Catted index /sob-ceri bk used ty determine the Fem. Clo] clement 7 4emp. 0, 1, clement sire clement sire 2,3,45 Y 8,9 Wf the ankay is at the beginning act asa declaration. total numbe y of used d to determine He Lelement si20 then Cif declared at first), temp C100] (0 to 99 elements) 51<1005 ia) { ] | 4 pvinf C* Enter 9 femp.:’)sAicrays ae of the following types: * Dne dimensional array “Tao dimensional atray “Three dimensional array. One dimensional array: SDA list of items can be given one vaviable name . i called Using only one subscript and such a variable a one dimensional a vray. ne Cog sbla 02, 17 O09 - ule] Uhow fo declare an arrays | type array bre] int afi] / fiat alic) J char olto) " for chairactes type airiray, sa is an asray ’ we can declare a, shiing, shas 10 elements ‘all the elemenls has integers.fr — becavee alt shy a0=l,a\=2,a4e3 int als]s= {12,33 met ayer oe Un implies that: + sobsctiip! can be empty. +The no. of elements declared was will be the no. of elements in the so bsctript- “bot, an the elements shold be declared shen. tOretse thay al 5 ]=gty’, ADA Ly oy char af j= UNA yy Ay | by defaust, the computer will -Lnderstand o C5) vserr. “bot, If you declare this in @ sting > ated “ings have a poy charactey Cthat we de noi cee)char aleJ= in’ Since only one svt of 6 characters have been Tdecianed, the vest of jhe 5 chanactess ill be asevmed fo be null characters by the compvtey. | for Ciz ty i ct00s +41) © eG c50)" \ sumli} = 0; aise somUiy=s; Gobto ebb ens 4) 45 » ”Wdouble averages int mavk C50] 5 inky, count, Sore 5 ; For (Val id= 505441) soreda tun { Prine ("Enter the mark: ")s scant ("Ad", & mark); t som = 04 ‘ 1 for Ccount = 0; Count ¢ = 50544 Count) t SLM = Som 4 marke j averrage = sum £504 Print C" Averages %a-dif", average )5 yeturn 0%| ink main t “int avg, sum= 05 “int i Int—mein ink markslsols, | «og Ms | for ( feo; i<=eesi70) ls | scant C'% a", & marksCid); 3 For Ci= 05 7K =443 44) 3 som = sum4 mark) avg = 90m /505 | \|s printf (* avg> “4 " avg)? aeforn %
You might also like
C Language Notes-2
PDF
No ratings yet
C Language Notes-2
40 pages
Programming Keys
PDF
No ratings yet
Programming Keys
20 pages
Unit 3
PDF
No ratings yet
Unit 3
19 pages
Fortran
PDF
No ratings yet
Fortran
70 pages
Java Notes
PDF
No ratings yet
Java Notes
37 pages
C Language Notes-1
PDF
No ratings yet
C Language Notes-1
41 pages
C Language
PDF
No ratings yet
C Language
107 pages
cpr assignment part 1 (1)
PDF
No ratings yet
cpr assignment part 1 (1)
25 pages
Control Flow: Branching
PDF
No ratings yet
Control Flow: Branching
38 pages
C Programming
PDF
No ratings yet
C Programming
54 pages
Yashvantkanetkar) Chapter 2: Let Us C (By Solution
PDF
No ratings yet
Yashvantkanetkar) Chapter 2: Let Us C (By Solution
27 pages
mcs011 Solved Guess Paper
PDF
No ratings yet
mcs011 Solved Guess Paper
25 pages
C Programming and Data Structures Notes Sample Compressed
PDF
No ratings yet
C Programming and Data Structures Notes Sample Compressed
8 pages
Assignment 2
PDF
No ratings yet
Assignment 2
21 pages
Introduction To Computers and Programming: Let Us C by Yashavant Kanetkar
PDF
No ratings yet
Introduction To Computers and Programming: Let Us C by Yashavant Kanetkar
42 pages
C Programming and Data Structures Notes Sample Compressed
PDF
No ratings yet
C Programming and Data Structures Notes Sample Compressed
8 pages
C Programming Notes Part 3
PDF
No ratings yet
C Programming Notes Part 3
24 pages
Intro To C Prog - Part 2
PDF
No ratings yet
Intro To C Prog - Part 2
39 pages
PIC chapter 2-Control Structure
PDF
No ratings yet
PIC chapter 2-Control Structure
30 pages
L3-Managing Input - If Else - Looping - PGD
PDF
No ratings yet
L3-Managing Input - If Else - Looping - PGD
39 pages
C
PDF
No ratings yet
C
93 pages
C Notes
PDF
No ratings yet
C Notes
241 pages
Introduction to C (3)
PDF
No ratings yet
Introduction to C (3)
45 pages
Assignment 2
PDF
No ratings yet
Assignment 2
11 pages
Vdocument - in Let Us Cby Yashwant Kanetkar Chapter 2 Solution
PDF
No ratings yet
Vdocument - in Let Us Cby Yashwant Kanetkar Chapter 2 Solution
27 pages
Programming in C-Peters Final
PDF
No ratings yet
Programming in C-Peters Final
163 pages
lecture 4
PDF
No ratings yet
lecture 4
24 pages
C programmings
PDF
No ratings yet
C programmings
47 pages
New C Programing Notes
PDF
No ratings yet
New C Programing Notes
74 pages
Assignment 1 .pdf
PDF
No ratings yet
Assignment 1 .pdf
9 pages
C LANGUAGE NOTES
PDF
No ratings yet
C LANGUAGE NOTES
19 pages
C Programming
PDF
No ratings yet
C Programming
42 pages
MAT & C Lab
PDF
No ratings yet
MAT & C Lab
32 pages
3 Control Flow
PDF
No ratings yet
3 Control Flow
11 pages
FYBsc Imaperative Programming QP Code 0895
PDF
No ratings yet
FYBsc Imaperative Programming QP Code 0895
18 pages
Computer Past Papers
PDF
No ratings yet
Computer Past Papers
14 pages
C-Lab-manual
PDF
No ratings yet
C-Lab-manual
16 pages
For Beginner C Programming Language Note
PDF
No ratings yet
For Beginner C Programming Language Note
32 pages
PSC Questions Sessional
PDF
No ratings yet
PSC Questions Sessional
14 pages
Programming in C' and Data Structure: Dr. Anand Kumar M.S. Engineering College Bangalore
PDF
No ratings yet
Programming in C' and Data Structure: Dr. Anand Kumar M.S. Engineering College Bangalore
41 pages
C Programming Notes - 21759696
PDF
No ratings yet
C Programming Notes - 21759696
32 pages
C Programming Lab
PDF
No ratings yet
C Programming Lab
39 pages
Pseudocode City Ravi
PDF
No ratings yet
Pseudocode City Ravi
15 pages
C Programming Language
PDF
No ratings yet
C Programming Language
55 pages
C Program Manual 1BCA
PDF
No ratings yet
C Program Manual 1BCA
20 pages
02_dataType
PDF
No ratings yet
02_dataType
7 pages
Flow of Control
PDF
No ratings yet
Flow of Control
42 pages
Basic Handnote of CSE-101 Course
PDF
No ratings yet
Basic Handnote of CSE-101 Course
43 pages
structure of C program
PDF
No ratings yet
structure of C program
13 pages
C Programming & Data Structure Sample
PDF
No ratings yet
C Programming & Data Structure Sample
8 pages
Types, Operators, and Express Ions
PDF
No ratings yet
Types, Operators, and Express Ions
50 pages
Presentation Slides
PDF
No ratings yet
Presentation Slides
156 pages
eem201ct1
PDF
No ratings yet
eem201ct1
13 pages
Output: Example Input
PDF
No ratings yet
Output: Example Input
23 pages
Algorithm SC 2006
PDF
No ratings yet
Algorithm SC 2006
138 pages
The Decision Control Structure
PDF
No ratings yet
The Decision Control Structure
42 pages
CPP Notes Upto Recursion
PDF
No ratings yet
CPP Notes Upto Recursion
24 pages
Programming and Data Structures: Control Flow: Looping
PDF
No ratings yet
Programming and Data Structures: Control Flow: Looping
55 pages
Related titles
Click to expand Related Titles
Carousel Previous
Carousel Next
C Language Notes-2
PDF
C Language Notes-2
Programming Keys
PDF
Programming Keys
Unit 3
PDF
Unit 3
Fortran
PDF
Fortran
Java Notes
PDF
Java Notes
C Language Notes-1
PDF
C Language Notes-1
C Language
PDF
C Language
cpr assignment part 1 (1)
PDF
cpr assignment part 1 (1)
Control Flow: Branching
PDF
Control Flow: Branching
C Programming
PDF
C Programming
Yashvantkanetkar) Chapter 2: Let Us C (By Solution
PDF
Yashvantkanetkar) Chapter 2: Let Us C (By Solution
mcs011 Solved Guess Paper
PDF
mcs011 Solved Guess Paper
C Programming and Data Structures Notes Sample Compressed
PDF
C Programming and Data Structures Notes Sample Compressed
Assignment 2
PDF
Assignment 2
Introduction To Computers and Programming: Let Us C by Yashavant Kanetkar
PDF
Introduction To Computers and Programming: Let Us C by Yashavant Kanetkar
C Programming and Data Structures Notes Sample Compressed
PDF
C Programming and Data Structures Notes Sample Compressed
C Programming Notes Part 3
PDF
C Programming Notes Part 3
Intro To C Prog - Part 2
PDF
Intro To C Prog - Part 2
PIC chapter 2-Control Structure
PDF
PIC chapter 2-Control Structure
L3-Managing Input - If Else - Looping - PGD
PDF
L3-Managing Input - If Else - Looping - PGD
C
PDF
C
C Notes
PDF
C Notes
Introduction to C (3)
PDF
Introduction to C (3)
Assignment 2
PDF
Assignment 2
Vdocument - in Let Us Cby Yashwant Kanetkar Chapter 2 Solution
PDF
Vdocument - in Let Us Cby Yashwant Kanetkar Chapter 2 Solution
Programming in C-Peters Final
PDF
Programming in C-Peters Final
lecture 4
PDF
lecture 4
C programmings
PDF
C programmings
New C Programing Notes
PDF
New C Programing Notes
Assignment 1 .pdf
PDF
Assignment 1 .pdf
C LANGUAGE NOTES
PDF
C LANGUAGE NOTES
C Programming
PDF
C Programming
MAT & C Lab
PDF
MAT & C Lab
3 Control Flow
PDF
3 Control Flow
FYBsc Imaperative Programming QP Code 0895
PDF
FYBsc Imaperative Programming QP Code 0895
Computer Past Papers
PDF
Computer Past Papers
C-Lab-manual
PDF
C-Lab-manual
For Beginner C Programming Language Note
PDF
For Beginner C Programming Language Note
PSC Questions Sessional
PDF
PSC Questions Sessional
Programming in C' and Data Structure: Dr. Anand Kumar M.S. Engineering College Bangalore
PDF
Programming in C' and Data Structure: Dr. Anand Kumar M.S. Engineering College Bangalore
C Programming Notes - 21759696
PDF
C Programming Notes - 21759696
C Programming Lab
PDF
C Programming Lab
Pseudocode City Ravi
PDF
Pseudocode City Ravi
C Programming Language
PDF
C Programming Language
C Program Manual 1BCA
PDF
C Program Manual 1BCA
02_dataType
PDF
02_dataType
Flow of Control
PDF
Flow of Control
Basic Handnote of CSE-101 Course
PDF
Basic Handnote of CSE-101 Course
structure of C program
PDF
structure of C program
C Programming & Data Structure Sample
PDF
C Programming & Data Structure Sample
Types, Operators, and Express Ions
PDF
Types, Operators, and Express Ions
Presentation Slides
PDF
Presentation Slides
eem201ct1
PDF
eem201ct1
Output: Example Input
PDF
Output: Example Input
Algorithm SC 2006
PDF
Algorithm SC 2006
The Decision Control Structure
PDF
The Decision Control Structure
CPP Notes Upto Recursion
PDF
CPP Notes Upto Recursion
Programming and Data Structures: Control Flow: Looping
PDF
Programming and Data Structures: Control Flow: Looping