Successfully reported this slideshow.
Your SlideShare is downloading. ×

c programming language.pptx

Ad
Ad
Ad
Ad
Ad
Ad
Ad
Ad
Ad
Ad
Ad

Check these out next

1 of 20 Ad

More Related Content

Similar to c programming language.pptx (20)

Advertisement

Recently uploaded (20)

c programming language.pptx

  1. 1. Ms.K.Banupriya Assistant Professor Department of Information Technology Bon Secours College for Women, Thanjavur.
  2. 2. C is the programming language developed by dennis M . Ritchie at Bell lab in USA. ‘c’ is a middle level language . UNIX operating system was written in ‘c’ language. ‘c’ language is used as most common platform for developing system programs.
  3. 3.  It is one of the most popular computer language today because it is a structural,high-level machine independent language. It allows the developes to develop programs without worrying about the hardware about the platform where they will be implemented.
  4. 4.  Programs written in c are efficient and fast.  There are only 32 keywords in ANSIC and its strength lies in this built-in-function.  C is highly portable.  C language is well suited for structured programming .  Another important feature of c is its ability to extend itself.
  5. 5. #include<stdio.h> #include<math.h> Void main() { Clrscr() int a,b,c, printf(“Enter the value for a&b”); Scanf(%d%d”,&a&b); C=a+b; Printf(“The addition result is” getch(); }
  6. 6.  c operator can be classified of a number categries.These are 1.arithmetic operator 2.Relation operator 3. Logical operator 4. assingment operator 5.increment &decrement opertor 6.condition operator 7. Bitwise operator 8. special operator
  7. 7.  arithmetic operator is used to performing mathematical operations such as addition subtraction multiplication , division ,modules,. operator meaning + Addition _ Subtraction * Multiplication / Division % Module
  8. 8. #include<stdio.h> #inlude<conio.h> Void main( ) { int a,b; Clrscr( ); Printf(“Enter the two value:n”); Scanf(“%d%d”,&a&b); Printf(“addition:n”,a+b); Printf(“subtraction:n”,a-b); Printf(“multiplicationm:n”,a*b); Printf(“division:n”,a/b); Printf(“module division:/n”,a%b); getch(); }
  9. 9.  a relational operator checks the relational between two operands . If the relation is true ,it returns 1; if the relation is false , it returns value 0.relational operator are used in decision making and loops operator meaning < Is less than <= Is less than or equal to > Greater than >= Is greater than or equal to == Is equal to != Is not equal to
  10. 10. #include<stdio.h> #include<conio.h> Void main( ) { int a,b; clrscr( ); Printf(Enter the two value:n”); Scanf(“%d%d,&a&b); If(a>b) { Printf(“A is the greater than:n”) } Else { Printf(“A is the greater than :/n”) } Getch( ) }
  11. 11.  We use logical operator to perform various logical operations on any set of given expressions . logical operator meaning && Logical AND || Logical OR ! Logical NOT
  12. 12. #include<stdio.h> #include<conio.h> Void main( ) { int a=40,b=20,c=30,D=40; clrscr( ); If(a>b&&c<d) Printf(A is greater than B OR D is greater than C”); Else Printf(logical OR function does not satisfied ”) Getch( ) }
  13. 13.  Assignment operator are used to assigning value to a variable.  Left side operand of the assignment operator is a variable and right side operand of the assignment operator is a value compound assignment equivalent assignment A>>=B A=A>>B A&=58 A=A&58 A|=B A=A|B A^=B A=A^B A/=(B+C) A=A/(B+C) A%=(X%10) A=A%(X%10)
  14. 14. PROGRAM: #include <stdio.h> #include<conio.h> Void main( ) { Int a=10,b=20 Clrscr( ); Printf(“A%d”,a); Printf(“n B%d”,b) a=a+b Printf(“nA%d”,a); Getch( ) }
  15. 15.  ++ and - - operators are called increment and decrement operators.  they are unary operator needing only one operand.hence ++ as well - - operand can appear before or after the operand with same effect. compound assignment equivalent assignment A>>=B A=A>>B A&=58 A=A&58 A|=B A=A|B A^=B A=A^B A/=(B+C) A=A/(B+C) A%=(X%10) A=A%(X%10)
  16. 16. PROGRAM: #include<stdio.h> #include<conio.h> Void main ( ) { Int a=10, Clrscr( ) Printf(“A++ is ,%d”,a++); Printf(“n A is ,%d”, a); Getch( ); }
  17. 17.  conditional operator is a single programming statement ,while the if-else statement is a programming block in which statements come under the pranthesis. exp 1,exp 2, exp 3  This operator is used as a pointer to a variable . comma operator size of the operator
  18. 18.  bitwise operator are character that represent action(bitwise operation) to be performed on single bits .  they operate at the binary level and perform operation on bit patterns that involve the manipulation of individual bits . operator meaning & bitwise AND | Bitwise OR ^ Bitwise exclisive OR << Left shift >> Right shift ~ One’s complement
  19. 19. PROGRAM: #include<stdio.h> #<inlude<conio.h> Void main( ) { Int test=1; Int number; Printf(“input a numbern”) Scanf(“%d”,& number); While(number!=-1) { If(number&test) Printf(“Number is odd n”); Else Printf(“Number is even n”); Printf(“input a numbern”); Scanf(“%d”,&number); } }

×