What is computer:-
Computer is an Electronic device which accept all information from the input device processing, processing it and give desired output such electronic device is refared as a computerHardware:-
The physical component of a computer based is refared as hardware we can touch this part of a computer based systemProgram:-
The set of instructions is refared as programSoftware:-
The collection of program is refared as software. There are two types of software1.System software
2.Application software
System software:-
It is also a collection of program design to control entire computer based system is called softwareThe opening system is an example of system softwareWhat is oprating system:-
It is a software program it just like as an entire phase between used and entire computer based system refared as opratimg system.There are two basic characteristics of any oprating system1)All necessary hardware working is in efficient mannerThe entire system is convenience for the usesThe example of an oprating system are Dos,window,linux,Android.........etc.Application Software:-
It is also the collection of program design for specific application is called application softwareEx:- Ms office,photoshop,coroldraw......etcAlgorithm:-
The sequence of steps is known as algorithm.We can any computer problem it consist of varies steps those steps written inEx:- The algorithm for the addition of two numbers i.e C=A+B1.Start2.ReadA,B3.SetC=A+B4.StopFlow chart:-
The graphical representation of an algorithm is known as flowchartIn flowcharting various symbol can be used1)C=A+BStart↓ReadA,B↓C=A+B↓Display C↓StopWrite an algorithm and draw a flowchart for sum of and average of three numberSum=A+B+CAvg=sum÷3Algorithm1)start2)readA,B,C3)Set sum=A+B+C4)Set Avg=sum÷35)Display sum6)StopeFlowchart:-StartReadA,B,CSum=A+B+CAvg=Sum÷3Display sum avgQ1.Write an algorithm and draw a flowchart for largest of two numberA>BAlgorithm1)Start2)Read A,B3)If (A>B)Then Display "A is largest"3)StopeLanguageLanguage is a group of string. The string is the gruop of character in day to day life we can use natural language likeEnglish,Hindi,marathi,...etc with the help of natural language people comunicating to each otherProgramming languageIt is the soacial language can communicate with the computer based system it is also called computer language. It is classified into three types of computer language1) Machine language2) Assembly language3)high-level language1) Machine languageIt is the machine dependent language it is esaly understand by the computer. The machine language can uses the binary digit that is zero and one (0and1).The program written in the sequence of(0and 1) it is difficult to understand the other user2) Assembly languageThis language can uses the instructions replace by binary digit . It consist of various instruction to performSpecified task this language is no competable with the computer based languageEx:- ADD This instruction use for AdditionAssembler:-It is the translator program it convart assembly language into Machine language which is competable with computer based system3)high-level languageThis language is similar to english language . It is easly understand by the user the different kinds of High lavel language are basic,COBOL,FORTRON,PASCALC,C++........etcCompilerCompiler is a translator program. It translate the highLavel language program converted into machine language is easly understand by the computer. It accept the source code translate into object code or machine language shown below the differnt programming language support compiler like,C,C++,The Compiler can take the hole program convert into machine language and it notify errorsSource code→compilre→Object code→machine languageInterpriatorIt is a translator it translate the high language program into Machine language the interpriator can accept the source code convert into object code or machine language as given below the the different programing language support translator program like BASIC, FORTRON....etc the interpriator can take line by lineintriationSource code→Intreprator→Object code→machine languageHistory of C languageIn 1960 sevaral computer language had come exist each one is design a specific perpose Ex:BASIC For biger COBOL was used for comercial business application, FORTRON is use for Engineering and scientific problem at this stage people started thinking for learning for general perpose programing language there for the international community setup to develop a such genarl perpose programing language this comunity come out with a language called ALGOL 60 but this language never popular because it is too abstract that is therotical and too general to reduce these abstractions and new language called combiner programming language (CPL) was devalped at cambridge university USA to solve any kindes of problem around the same time the new language developed by the ken Thompson at cambridge university in USA in the middle of 1972 developed by denis Rihchiee it is the combination of all kinds of programming languages C language can be designed friendly competable and reliable
- C language is one of the high lavel language consist of rich set of function it is the prosiger oriented language the C function and statement are written under the blog that is {(opening brase symbol)and }(closing brase symbol) many times it is called a blong oriented language the C language support the top down design model it is also the middle lavel language because it interphase with the hardware
C token
The smallest individual unit is refared as token .In c programming language the various token can be used these are given below
1)Constant and variable
2)Identifire
3)Keyword
4)Operator
5)Data type
1)Constant
A contity or identifier whose value does not change during the program exucation is called constsnt it is the fix value such value does not change the constsnt asgine to the variable and its value stored in the memary location Ex:- -5,10,200,........etc
The constsnt are classified into two types
1)Nummeric Constant
2)Non numeric Constant
1)Numeric constant
The numeric Constant can process the digit the numeric constant is agin classified into two types
1)Intiger constant
2)Float constant
1)Intiger constant
A number without includ decimal point is refared as integer constant
Ex:- The any natural point is Refared as intiger constant such as 5,10,200......etc
The following are the rule to define intiger constant
1)It must have at list on digit
2)It does not include decimal point
3)It may be either positive or negative
4)The defulat sign is positive the intiger constant can define in the range -32768to32767
2)Float constant
A number includ decimal point such constant is refared as float constant
Ex:--4,5,-10,12,....etc
The following are the Rule to define float contant
It must hve a decimal point
It must have atlist one digit
It may be either positive or negative
The default sign is positive
It's range is -3.4×10‐³⁸ to 3.4×10³⁸
It single prieciession float number are 10.123456 it alowed six digit after decimal point
In dubble prision it allow 8 digit after decimal point
Ex:- 10.12345678
If the number to small and too large such number converting into exponent by using letter 'e'
Ex:- 3.4×10³⁸written as 3.4e-38
The exponent number consist of following rules to define in the program
The mantissa and exponent may either positive or negative
The default sign is positive
Non numeric constant:-
The nonnumeric constant can manupulate stright is callsified into two type of constant
1)Character Constant
2)Starting constant
1)Character constant:-
The chractar constant can have a single latter,a digit single spacial symbol which enclosed in single quote is called character constant. The maximum length of this constant in a single character
Ex:- 'A'
'$'
'1'......etc
String constant
String is the group of character the string constant is the combination of latter,digit and special symbol which enclosed in dubble quotations mark is called string constant
"MUMU"
"SUM=>"
"1 2 3"
" "......etc
The null string doesnot have any character
Variable
The quantity or Identifier whose value allowed to change during the program esucatation is called variable the variable name are the name given to location in the memary of the computer where the different values or constant are stored.
Ex:- The numerical variables are
"AtoZ"and"atoz
The variable name is any combination of Alphabet digit and undes score symbol (-)is refared as Identifier
It is use as any name except 'C' keyword or statement the maximum length of Identifier are '1to8' character the first character. The first character Identifier must be a Alphabet. The no(') or blank space are called.The no spacial symbol accept underscore (_).
Ex:- Sum,fact
S_um
Su_m
_Sum...........etc
Keyword :-(Reserved word)
The meaning of keyword or reserved word is already define in thr C compiler such word is called keyword
It is the spacial word which is define in the C software to written a C program language there are 32 keywords are available the valid keyword are int,float,double, if,else,while.......etc
Opretor
Opretor is a symbol which telle to the compiler to perform a certain opration such symbol is refared as opretor .In C programming language it consist of various opretor
Arithmatic opretor
This opretor are used to perform the arithmatic opration such as addition (+) Subtraction(-),Multiplication(×)Division(%)andmodulus(/)
These opretor on two operand or variable the expration by using arithmatic expression
Ex:- A+B
A-B
A×B
A/B
A%B
Suppose A=4&B=3then
4+3=7
4-3=1
4×3=12
4/3=1
4%3=1
Rational opretor
This opretor are used to perform the relation operand it is the comparison opretor because it compire the two operand these opretor are <,><=,>=,==(equal to),!=not equal
The ralational expression are using raltional opretor symbol suchasA<B,A>B,A<=B,A>=B,
A==B
These oprator are use to perform the test condition.
Logical opretor
The logical oprator are used to perform logical opration the logical OR and logical NOT the logical symbol denotes logical AND opration (||) denote logical or opration and != it denotes logical not opration the logical oprator are performed on two oprand the following table shows the AND,OR,andNOT opration
The expression by using opretor such expression called logicalexpressiontheAND,OR
expression perform and NOT
expression and Not expression performed on one operant
A>B&A>C
A>B||A>C
!A
!B
Assignment opretor: -
The assignment opretor are denoted by a symbol (=) It can be written with following syntax
Var =constant
Or
Var
or
Expression
In this syntax every assignment opretor consist of two parts i.e left hand side (LHS)and Righthandside(RHS) is calculated first and it is assian to left hand side
Ex:- A=2;
B=A;
C=A+B;
Those expression are the assignment expression
Spacial assignment opretor for short hand side
This opretor is similar to assignment oprator it syntax is
Var op=const
or
var
or
expr
Where op is the arithmatic oprator such as +,-,×,/,%,
The value of left hand side variable can be use in right hand side expression which is similar to
A+=2⇒A=A+2;
B-=A⇒B=B-A;
C×=2⇒C=C×2;
A/=(A+B)⇒A=A/A+B;
A%=C⇒A=A%C;
Increments/ Decrement oprator
This oprator denoted by a symbol(++)and(-).The(++) stand for incrementation by 1.
The (--) stands for decrementation which is the value of operand is decremented by 1. It can written in two forms i.e preincrementation and postincrementation i.e(++1)and (1++) similarly for decrementation i.e(--1)and(1--) In pre incrementation the value of operand is incremented by 1 and asgine to the variable.
In post incrementation the operand is assig to the variable the after increment the operand
Similarly for decrementation i.e pre and post decrementation the following example shows increment and decrement
Ex:- 1)I=2
Y=++i
i=3;y=3
2)i=2
Y=i++
Y=2;i=3
Decrementation
1)i=2
Y=--i
Y=1;i=1
Conditional opreator
The conditional opreator is denoted by a symbol (?)colan.It syntax is
exp?exp2:exp3
Where
exp,exp2 and exp3 are the expression this oprator is executed when expression 1 must be a test condition. If the condition is true it written the exp2 otherwise it will written exp3 when condition is false this oprator is also called ternary opretor
Ex:- A=20;
B=10;
y=A>B?A:B;
O/P-Y=B
Bitwise operator
This opretor are used to perform bit by bit manipulation these oprator are oprator on 0 or 2 oprand it consist of various bitwise operator used in c program
เด→1's complement
This opretor on one oprand each bit one replace by zero and zero replace by one
Ex:- A=2
Y=เดA
เด (0010)
(1101)
Y=13
&→Bitwise and
This Opretor are oprat on two operand in And opration when both inputs are one then it's output is 1 otherwise 0 as shown in the truth table
Ex:-
A=2
B=3
Y=A&B
Y=2
& 0010
0011
0010
( | ) →Bitwise or
This oprator oprate ono two oprand the opration is when both inputs are zero then it's output is zero otherwise then it's output is zero one as shown in the above truth table
Ex:- A=2
B=3
Y=A|B
Y=3
Bitwise xor -∧
It also oprate on two oprand when both inputs similar then it's output is zero otherwise one as shown in the above truth table
Ex:- A=2
B=3
Y=A∧B
Y=1
Data types
In c programming language we can use different data those data belongs to certain types is called data types.The similar value can be process in the program using data types. In c program the data type is classified into four types
1)primary
2)userdefined
3)secondary
4)Empty
Primary data type :-
This data type is also built in data type because those data type are already define in the c- compiler those data type is of four types
1)char-1byte
2)int-2byte
3)float-4byte
4)dubble-8byte
a)char
This data type can process the character constant that is a single latter.It can takeone bytes of storage capacity allocated to a single character
b)Int
It is the integer data type it can process integer constant it can take two bytes of storage capacity
c)Float
This data type can process real or floating point value it can take four bytes of storage capacity
Comments