0% found this document useful (0 votes)
3 views

c programing 1st unit introduction to programming

1st
Copyright
© © All Rights Reserved
Available Formats
Download as PDF or read online on Scribd
0% found this document useful (0 votes)
3 views

c programing 1st unit introduction to programming

1st
Copyright
© © All Rights Reserved
Available Formats
Download as PDF or read online on Scribd
You are on page 1/ 11
v “asics ors commures S PROGRAMAlgorithin: Introduction To Programming, “Saleh Savtee Convent tAEO ony Fea Melivences: The operations of ihe algorithm must be effective stich ¢Hat it my onl te asily converted into machine code in a finite amount of time ‘one of more inputs and one ithm for adding Ovo numbe Start Y Flow chart is diagrammatic representation of an algorithm, ¥ It is built using different types of boxes of symbols. Y The operation to be performed is written in the box. ¥ All symbols are interconnected by arrows to indicate the flow ofinformation and processing, Input / Output ‘start/stop/begin/end symbo ieee ee Making data available for processing (inPut) OF recordings, the processed information __ (outpud), Process “Any processing t0 be performed. An assignment represented by this symbol, Decision or switching type of operations that determines which of the alternative paths is to be followed. Connecter ‘Used for connecting different parts of flow chart. Joins two symbols and also represents executions flow. ‘Bracket with ‘broken line Annotation Descriptive comments or ‘explanations ‘Double sided Predefined. ‘Modules or subroutines given elsewhere. isthe structure ofa C Program. Se Link Section —___—| Sete eon _—__— fuating) Function Section (Decinration part Executable part sion consis of ott comment lines giving the mame of tion Setion:- The docursentaton et ‘woul ike 0 use ser the author snd otber detail, which the programmes yoaypes of comment ines elo. Je ine comment using the symbol / ple’ (Tis ¢ Programming jtline comment using the symbo}/* >i thee program “To learn aod pctice *Y eto ries tins f eine hk nn on tes a, © staiohanio hm al the Fuions which ae defined by this provide plenty of Hibrary Tike eb attach othe curen programs i the flowing W9y. clink between eureit program tothe ary function, en section The dation selon dares al symbsie corslan&.Usng. ch S = PES nae 8 biol eed provides th fine PL3.141 ‘pdefine X20 A fin section:= There ar some vajabls that are cied in more than one fantion, Such te declared in the glob declaration section tht is outside ofall lee called global vatles a Scr cetion aso deceres all he uset- defined fnctons Se runction sectlon:- Every © program mus! have one nan funcion incor son contains two pars, declaration part and executable part pat declares lhe vars wei excuse put ee th areentble part. Tete No pts mA. appear Between the opening Be evuton begins at the opening brace and ends atthe closing brace reevetion fe the logical end of the program. All satements inthe a east one saterent i ing braces. THE POE soa trace of ie rain foncti ‘race 0 se pats end with a semicolon ov are cated in the ia faction, gy sect con al eerie unto th 3 A peerinty ate generally paced iomeditly fer the wa ~Allsecon, espe mas anton oan my bet when ey rte Ee 1. Write C Program to print welcome message. _ included > oid maing t print" WELCOME’, 3 ‘OUTPUT: WELCOME 2. Write a € program for adition of mambers #inelude void main() { invade: elise) 2100; b= 200; enaib; prindt*\n sum=Y%6d",0); ) ourruT: ge is done using daar A whic Tecaing meory oF al ASAP eg = oatng, STAC eo 1 USE. ecg ‘of data that a le can store such as inte Pie. i ise in a program. ‘Variables or functions of dtferent types before ( Data Types in C sare 4 types of datatypes in C language Data types following are some main primitive data types in C: e Seats ts Ci wed oe te ue Ve and zero without decimal part), Octal values, hexadecimal values, and decima, He stored init data ype in C. We usedutkxsaaraso declare the inteust variable: S 7 Range: -32768 to 32767 ” > a Stn ayes a = Format Specie: Ya (Syntax for declaring the Integer variables int var_name: aes £ The niger datatype can also be used as A© ‘unsigned int: Unsigned int dato type in Cis used to store the data. values ftom 22 fo _-ambers but tan sore gave values ie ined int 2 short int: iis lesser in size tan ho an ee oe Larger version of the int datatype so can store values greater than int, ce yon os xsiged int i can only store values ffom 3273 Note: The size ofan integer data type is compiler dependene. We can use sizeof operator toch actual size of any data F data type allows its variable to store only a single character. The sizeof he cad byte. It is the most basic data type in C_Tr store = Slagle character and requires singe ‘memory in amos allsompilers. The char Keyword is uscd to declare the varabe of chara a «Range: (-128 to 127) or (0 to 255) + Size: | byte sax idedadag he Cm es rr ie ‘char var_name; char a sed to store ming float datatype is used to store floating-point values. Flout in C : is used to store deci " swith floating pom ‘exponential values. It is used to store decimal mumbers (numbers a floating point ingle precision, The float keyword is used o declare he variable as Range: 120-38 1 348498 Sine: 4 bytes Format Specifier: %6t laring the floating point variables: data type is basically a precision sort of datatype that is capable of holding 64 bits of points. Since double has more precision as compared to that float then ‘occupies twice the memory occupied by the floating-point type.It cay point. The variable can be declared ) ‘The void data type in C is used to specify that no value is present. It does not 1k value to its caller, It has no values and no operations. It is used to represent nothing *ssoyesodQ, don soyeiodo oy st + pue spuesodo “UNS2y Paaisop 94 393 0} spu sojqetiea outs sie sioresodo uy "voneiodo uy susioy.od exp joquig » s) sowwiodo wy Ba aemint opie ical values (constants and variables). re the working of arithmetic operators ‘printit'a+b = %d \n",¢); math; printf("a*b-= %d In"): cal printi('a%o = Yd \n',); oath; Brintit"Remainder when a divided by b 044 i \n",c); when a divided by bet ip berveen wo operands: ye variate chooks the relations om Jn fae It returns value 0, Operands may in decision making ans loops Operators: A relational o tom is eve, Ht returns 15H i greater than oF equal to is equal to 95d = %d\n", a,c, a= 0); False se %od= %d\n", 0, b, a> bs Yod= Yd \n", a, 60>); false Y= 9d \n", a,b, a); false < Yok = %d \n", a,c, 6)i

You might also like