C PROGRAMMING LANGUAGE

INTRODUCTION :
     
C is a general-purpose, imperative, procedural high level  language that was developed in 1972 by Dennis Ritchie at the Bell Telephone Laboratories. For the UNIX operating  system.  This C language is first implemented on the Digital Eqquipment  Corporation  computer in 1972, and now one of the most widely used programming languages. C has also influence many popular languages, especially C++, which was originally designed as enhancement to C . It is also most commonly used programming  languages. It is widely used for writing applications.

C CHARACTER SET
Types of Character Set 
    
       *  Letters
       *  Digits
       * Special characters

   Letters:
 . A to Z in capital and small letters
. In c language small latter and caps latter are distinct.
 
   Digits:
. Sequence of number is associated the letter 0 to 9.
 
   Special characters:

SymbolMeaning
 ~ Tilde
 !Exclamation mark
 #Number sign
 $Dollar sign
%Percent sign
 ^Caret
 &Ampersand
  *Asterisk
(Left parenthesis
 )Right parenthesis
_Underscore
 +Plus sign
 | Vertical bar
  \ Backslash
 ` Apostrophe
 – Minus sign
 = Equal to sign
  { Left brace
  } Right brace
 [ Left bracket
] Right bracket
 :  Colon
 ” Quotation mark
 ; Semicolon
 < Opening angle bracket
 > Closing angle bracket
  ? Question mark
 , Comma
 .Period
  / Slash

    Simple C programn- Hello World

     INPUT:
  1. #include <stdio.h>
  2. int main()
  3. {
  4. // printf() displays the string inside quotation
  5. printf("Hello, World!");
  6. return 0;
  7. }
    OUTPUT:


Hello, World!
Arithmetic Operator
 There are only five arithmetic operators in C language.
An arithmetic operator performs mathematical operations such as addition, subtraction, multiplication, division etc on numerical values (constants and variables).
OperatorMeaning of Operator
+addition or unary plus
-subtraction or unary minus
*multiplication
/division
%remainder after division (modulo division)
nihalvaidya29@gmail.com

Example 1: Arithmetic Operators

INPUT:
  1. #include <stdio.h>
  2. int main()
  3. {
  4. int a = 9,b = 4, c;
  5. c = a+b;
  6. printf("a+b = %d \n",c);
  7. c = a-b;
  8. printf("a-b = %d \n",c);
  9. c = a*b;
  10. printf("a*b = %d \n",c);
  11. c = a/b;
  12. printf("a/b = %d \n",c);
  13. c = a%b;
  14. printf("Remainder when a divided by b = %d \n",c);
  15. return 0;
  16. }
  17. OUTPUTS
    a*b = 36 a/b = 2 Remainder when a divided by b=1
  18. C – while loop

    Syntax of while loop:
    while (condition test)
    {
          //Statements to be executed repeatedly 
          // Increment (++) or Decrement (--) Operation
    }

    Flow Diagram of while loop

    C while loop

    Example of while loop

    #include <stdio.h>
    int main()
    {
       int count=1;
       while (count <= 4)
       {
     printf("%d ", count);
     count++;
       }
       return 0;
    }
    step1: The variable count is initialized with value 1 and then it has been tested for the condition.
    step2: If the condition returns true then the statements inside the body of while
  19. loop are executed else control comes out of the loop. step3: The value of count is incremented using ++ operator then it has been tested
  20. again for the loop condition.OUT#include <stdio.h>
  21. Example:#include <stdio.h>
    int main()
    {
         int var = 6;
         while (var >=5)
         {
            printf("%d", var);
            var++;
         }
       return 0;
    }
  22. Infinite loop: var will always have value >=5 so the loop would never end.
  1. Image result for thank you
  2. Welcome to my blog, and thank you for visiting!
  3. for more learning about c language keep 
  4. visiting...
  5.                           written by
  6.                            Nihal vaidya 
  7. 
    

Comments

Post a Comment

C LANGUAGE

How to install turbo C