Skip to main content
Open navigation menu
Close suggestions
Search
Search
en
Change Language, English
Upload
Sign in
Sign in
0 ratings
0% found this document useful (0 votes)
37 views
24 pages
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
We take content rights seriously. If you suspect this is your content,
claim it here
.
Available Formats
Download as PDF or read online on Scribd
Download
Save
Save C-Programming-Notes-Part-2 For Later
Share
0%
0% found this document useful, Mark this document as useful
0%
0% found this document not useful, Mark this document as not useful
Print
Embed
Report
0 ratings
0% found this document useful (0 votes)
37 views
24 pages
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
We take content rights seriously. If you suspect this is your content,
claim it here
.
Available Formats
Download as PDF or read online on Scribd
Go to previous items
Download
Save
Save C-Programming-Notes-Part-2 For Later
Share
0%
0% found this document useful, Mark this document as useful
0%
0% found this document not useful, Mark this document as not useful
Print
Embed
Report
Go to next items
Download
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
Programming Keys
PDF
No ratings yet
Programming Keys
20 pages
Pps Notes
PDF
No ratings yet
Pps Notes
26 pages
C Language Notes-2
PDF
No ratings yet
C Language Notes-2
40 pages
C Program.
PDF
No ratings yet
C Program.
21 pages
Unit 2 PPS
PDF
No ratings yet
Unit 2 PPS
19 pages
Python Programming Basics and Examples
PDF
No ratings yet
Python Programming Basics and Examples
10 pages
C Program: Fibonacci, Factorial, Leap Year
PDF
No ratings yet
C Program: Fibonacci, Factorial, Leap Year
24 pages
C LANGUAGE - Control Statements
PDF
No ratings yet
C LANGUAGE - Control Statements
38 pages
C Notes
PDF
No ratings yet
C Notes
22 pages
C Programming Slide 1
PDF
No ratings yet
C Programming Slide 1
9 pages
C Programming
PDF
No ratings yet
C Programming
42 pages
Programming With C Handwritten Notes
PDF
No ratings yet
Programming With C Handwritten Notes
63 pages
Python Programming Basics Explained
PDF
No ratings yet
Python Programming Basics Explained
87 pages
L-3 C Programming - English - Week End Batch - Gate Cse - 2027 - Compressed
PDF
No ratings yet
L-3 C Programming - English - Week End Batch - Gate Cse - 2027 - Compressed
45 pages
Programming Language Fundamentals Explained
PDF
No ratings yet
Programming Language Fundamentals Explained
11 pages
Python Control Statements Explained
PDF
No ratings yet
Python Control Statements Explained
22 pages
Python ?
PDF
No ratings yet
Python ?
62 pages
C Programming Basics: Constants, Variables, and Control Structures
PDF
No ratings yet
C Programming Basics: Constants, Variables, and Control Structures
54 pages
C Language Notes-1
PDF
No ratings yet
C Language Notes-1
41 pages
Unit 2 Notes
PDF
No ratings yet
Unit 2 Notes
24 pages
C Theory Notes
PDF
No ratings yet
C Theory Notes
56 pages
Python Control Flow Statements Explained
PDF
No ratings yet
Python Control Flow Statements Explained
61 pages
UNIT 7 C Programming
PDF
No ratings yet
UNIT 7 C Programming
38 pages
ANSI C Data Types and Control Flow Guide
PDF
No ratings yet
ANSI C Data Types and Control Flow Guide
10 pages
Control Flow in Python Programming
PDF
No ratings yet
Control Flow in Python Programming
61 pages
Control Statements in Programming
PDF
No ratings yet
Control Statements in Programming
22 pages
Image To PDF 20240808 20.19.48
PDF
No ratings yet
Image To PDF 20240808 20.19.48
9 pages
C Programming II Course Overview
PDF
No ratings yet
C Programming II Course Overview
39 pages
Programming in C - Unit-2
PDF
No ratings yet
Programming in C - Unit-2
27 pages
C Programming Basics and Examples
PDF
No ratings yet
C Programming Basics and Examples
51 pages
Data Structures and C Programming Guide
PDF
No ratings yet
Data Structures and C Programming Guide
41 pages
C Unit 1
PDF
No ratings yet
C Unit 1
56 pages
Python Programming Basics Explained
PDF
No ratings yet
Python Programming Basics Explained
70 pages
CamScanner 20-08-2025 13.47
PDF
No ratings yet
CamScanner 20-08-2025 13.47
64 pages
C - Programming - Handbook - Loop & Logic
PDF
No ratings yet
C - Programming - Handbook - Loop & Logic
59 pages
C Language Exponential Function & Arrays
PDF
No ratings yet
C Language Exponential Function & Arrays
33 pages
C Language Unit 1 Notes
PDF
No ratings yet
C Language Unit 1 Notes
33 pages
C Programming Basics: Flowcharts & Syntax
PDF
No ratings yet
C Programming Basics: Flowcharts & Syntax
11 pages
ICPR - Test 2 Notes
PDF
No ratings yet
ICPR - Test 2 Notes
59 pages
C Language
PDF
No ratings yet
C Language
9 pages
Unit 3
PDF
No ratings yet
Unit 3
19 pages
C Language Operators and Data Types Guide
PDF
No ratings yet
C Language Operators and Data Types Guide
25 pages
Flowchart and C Programming Concepts
PDF
No ratings yet
Flowchart and C Programming Concepts
15 pages
C Programming Keywords and Operators Guide
PDF
No ratings yet
C Programming Keywords and Operators Guide
27 pages
C Basics and Solved Programs
PDF
No ratings yet
C Basics and Solved Programs
7 pages
CSE 295 Lecture 2
PDF
No ratings yet
CSE 295 Lecture 2
53 pages
C Programming Language Study Guide
PDF
No ratings yet
C Programming Language Study Guide
22 pages
C Programming and Data Structures Notes Sample Compressed
PDF
No ratings yet
C Programming and Data Structures Notes Sample Compressed
8 pages
Computer Programming Methodology Course
PDF
No ratings yet
Computer Programming Methodology Course
3 pages
C Programming Basics and Concepts
PDF
No ratings yet
C Programming Basics and Concepts
284 pages
Programming Basics in C: Algorithms & Syntax
PDF
No ratings yet
Programming Basics in C: Algorithms & Syntax
104 pages
C Programming Basics: Data Types & Operators
PDF
No ratings yet
C Programming Basics: Data Types & Operators
30 pages
C Notes
PDF
100% (2)
C Notes
158 pages
Understanding Aircraft Control Surfaces
PDF
No ratings yet
Understanding Aircraft Control Surfaces
33 pages
Aircraft Parts and Systems Overview
PDF
No ratings yet
Aircraft Parts and Systems Overview
71 pages
Diode Characteristics Experiment Guide
PDF
No ratings yet
Diode Characteristics Experiment Guide
4 pages
C Programming Notes Part 1
PDF
No ratings yet
C Programming Notes Part 1
24 pages
Maths ODE Part 1
PDF
No ratings yet
Maths ODE Part 1
24 pages