Sunday, November 25, 2012

C LAB PROGRAM



/* 1. CHECK MAXIMUM VALUE THAT CAN BE REPRESENTED IN ALL THE 
        STORAGE  TYPES. [ int(short,long,signed,unsigned), char, double, float]
*/
* 2. WRITE A C PROGRAM TO REVERSE A NUMBER */

           
/* 3A. WRITE A C PROGRAM TO GENERATE 'N' PRIME NUMBERS. */

#
/* FUNCTION TO FIND PRIME NO. */

/* 3B. INPUT TWO INTEGERS 'N' AND 'M'.FIND THE NO. OF PRIME NUMBERS
    B/W 'N' AND 'M'(CREATE A FUNCTION WHICH FINDS IF THE GIVEN NO. IS
    PRIME.THIS FUNCTION CAN BE CALLED REPEATEDLY).
 */


/* 4A. WRITE A C PROGRAM TO GENERATE N FIBONACCI NUMBERS */


/* 4B. WRITE A C PROGRAM TO GENERATE FIBONACCI SERIES UPTO A GIVEN
   NUMBER */


/* 4C. WRITE A C PROGRAM TO GENERATE 3 DIGITS FIBONACCI SERIES */



/* PR5.WRITE A C PROGRAM TO CONVERT THE FOLLOWING :
            a. DECIMAL TO BINARY NUMBER
            b. BINARY TO DECIMAL NUMBER
            c. REAL DECIMAL NUMBER TO HEXADECIMAL NUMBER
            d. REAL DECIMAL TO OCTAL NUMBER


/* 6A. WRITE A C PROGRAM TO SUM THE SERIES:

                                                   x^3     x^5     x^7
                               SIN(x)= x - ----- + ----- + ----- + ...
                                                    3!        5!        7!   

/* 6B. WRITE A C PROGRAM TO SUM THE SERIES:

                                               x^2     x^4    x^6
                        COS(x)= 1 - ----- +  ----- - ----- + ...
                                                 2!       4!        6!         
*/

           

/* 6C. WRITE A C PROGRAM TO SUM THE SERIES:

                                                   x       x^2     x^3
                                e^x = 1 + ----- + ----- + ----- + ...
                                                   1!        2!       3!          */


/* 7. THREE POSITIVE INTEGERS a,b,c FORM A TRIPLET OF a^2 + b^2 = c^2.
     WRITE A C PROGRAM TO FIND ALL PYTHOGOREAN TRIPLETS a,b,c WHERE
     a,b < 120.
*/


/* 8. INPUT AN INTEGER N, FIND OUT THE POSITIONS OF OCCURRENCE OF  
    DIGITS  0,1,2,3,4,...9 IN THIS NUMBER. (CREATE A FUNCTION WHICH FINDS  
   THE POSITIONS OF OCCURRENCE OF A PARTICULAR DIGIT. THIS FUNCTION
   CAN BE CALLED REPEATEDLY).
*/



/* 9a.WRITE A CPROGRAM TO GENERATE THE FOLLOWING OUT PUT:

           a) 1
               2 3
               4 5 6
               7 8 9 10


/* 9b.WRITE A CPROGRAM TO GENERATE THE FOLLOWING OUT PUT:

            b)                     1
                                 1 2 1
                              1 2 3 2 1
                           1 2 3 4 3 2 1
                        1 2 3 4 5 4 3 2 1
/* 10. IN A GIVEN STRING, FIND THE FREQUENCY OF OCCURRENCE OF
    A PARTICULAR LIST
*/

# /* 11. WRITE A C PROGRAM TO ARRANGE ALL CHARACTERS IN A STRING
    IN ASCENDING ORDER.
*/

/* 12. WRITE A C PROGRAM TO FIND IF THE GIVEN STRING IS A 
    PALLINDROME */


/* 14. ACCEPT N WORDS (WHICH FORM A SENTENCE), ONE WORD AT A TIME.
    OUTPUT IT ON THE SCREEN AS A SENTENCE WITH BLANKS BETWEEN WORDS, AND A FULLSTOP AT THE END.
*/
/* 15.  INPUT A STRING AND FIND THE NUMBER OF NUMERIC CHARACTERS,
    LOWERCASE AND UPPERCASE ALPHABETIC CHARACTERS RESPECTIVELY  
    AND ANY OTHER THAN THE ABOVE
*/

/*  16.  INPUT A STRING AND FIND THE NUMBER OF TIMES, EACH OF THE FIVE
     VOWELS APPEAR IN THE GIVEN STRING
*/
# /*  17. WRITE A C PROGRAM TO DELETE ALL THE OCCURENCES OF A 
     CHARACTER IN A STRING.
/*  18. WRITE A C PROGRAM TO COPY THE CONTENTS OF ONE STRING TO
     ANOTHER.
*/

/*  19.  WRITE A C PROGRAM TO COUNT THE NUMBER OF WORDS IN A 
     SENTENCE.
            =====OUT PUT=====

           
/*  20.  WRITE A C PROGRAM TO COUNT THE NUMBER OF CHARACTERS,
    WORDS AND LINES IN A TEXT.
*/

/*  21. WRITE A FUNCTION TO FIND THE LENGTH OF A STRING. */

/*  22. WRITE A FUNCTION TO THE GCD OF TWO NUMBERS. USING GCD
     FUNCTION,WRITE A MAIN PROGRAM TO FIND THE LCM OF FOUR 
     NUMBERS.         

/* 23. WRITE A FUNCTION TO FIND THE FACTORIAL OF A NUMBER. USING
   THIS FUNCTION FIND nCr.
                                                                 n!
                                                nCr =  -----------
                                                             (n-r)! * r!

/*  24. WRITE A PROGRAM TO CHECK WHETHER A GIVEN ARRAY IS SORTED.
     (ASCENDING,DESCENDING OR UNSORTED)
*/
/* 25. WRITE A PROGRAM TO FIND THE LARGEST ELEMENT IN AN ARRAY AND
   POSITION OF IT'S OCCURENCE
*/
/* 26B. WRITE A PROGRAM TO SEARCH AN ITEM IN A LIST USING
    BINARY SEARCH
*/
* 27. INPUT A NxN MATRIX, DISPLAY IT IN MATRIX FORM AND DETERMINE IF
   IT IS A LOWER TRIANGULAR MATRIX. (LOWER TRIANGULAR MATRIX IS A
   SQUARE MATRIX IN WHICH ALL THE ELEMENTS ABOVE THE PRINCIPAL
   DIAGONAL ARE ZEROES
*/
/* 28. INPUT A NxN MATRIX, DISPLAY IT IN MATRIX FORM AND DETERMINE IF
   IT IS A UPPER TRIANGULAR MATRIX. (UPPER TRIANGULAR MATRIX IS A
   SQUARE MATRIX IN WHICH ALL THE ELEMENTS BELOW THE PRINCIPAL
   DIAGONAL ARE ZEROES

/* 29. INPUT A NxN MATRIX, DISPLAY IT IN MATRIX FORM AND DETERMINE
   IF IT IS AN IDENTITY MATRIX.
*/

/* 30. INPUT TWO NxN MATRICES A AND B, DISPLAY A,B AND A*B
   (CREATE THREE FUNCTIONS TO READ, DISPALY AND CALCULATE A*B)
*/
*/
/* 33. USE RECURSION TO FIND THE FIRST N TERMS OF THE FIBONACCI
   SERIES
*/
#
/* 34. WRITE A RECURSIVE FUNCTION TO FIND THE FACTORIAL OF A NUMBER */

/* 35. WRITE A RECURSIVE FUNCTION TO FIND THE SUM OF N NATURAL
   NUMBERS
*/

/* 37. USE RECURSION TO FIND X^n WHERE X IS A REAL NUMBER AND n
   IS AN INTEGER. n CAN BE NEGATIVE, ZERO OR POSITIVE

 /* 38. FIND THE SOLUTION OF THE GIVEN QUADRATIC EQUATION. ( CREATE
    A MACRO WHICH CALCULATES THE DETERMINANT.
                                                      ____________
                                         -A  ±   B^2 - 4*A*C
   Formula used:-   X =  --------------------------------
                                                            2*A
*/

/* 39. FIND THE LARGEST AND SECOND LARGEST OF THREE INTEGERS.
    ( CREATE MACRO WHICH FINDS LARGEST OF TWO INTEGERS.USE THIS  
    MACRO MULTIPLE TIMES. USE A NESTED IF ELSE STRUCTURE.)
*/

/* 40. CREATE AN ARRAY OF TEN ELEMENTS WHERE EACH ELEMENT IS A 
    STRUCTURE WITH THE FOLLOWING FIELDS : IDNO, NAME,MARKS AND 
    AGE. READ DATA INTO THIS ARRAY. FIND THE AVERAGE MARKS OF THESE
   TEN STUDENTS AND ALSO THE NAME OF THE YOUNGEST STUDENT.
*//* 41. DECLARE THREE POINTER VARIABLES TO STORE A CHARACTER,
    A CHARACTER STRING AND AN INTEGER RESPECTIVELY. INPUT VALUES
    INTO THESE VARIABLES. OUTPUT THESE POINTER VARIABLES AS WELL
    AS THEIR CONTENTS.


/* 44. INPUT THREE INTEGERS X, Y AND N.PERFORM
               a. BIT WISE AND OF X AND Y
               b. BIT WISE INCLUSIVE OR OF X AND Y
               c. BIT WISE EXCLUSIVE OR OF X AND Y
               d. BIT WISE COMPLEMENT OF X
               e. LEFT SHIFT OF X BY N BITS
               f. RIGHT SHIFT OF Y BY N BITS

   DISPLAY X,Y AND THE RESULTS OF THE ABOVE OPERATIONS IN BIT
   FORMAT.


/* 45. CREATE A FILE OF TEN RECORDS WHERE EACH RECORD HAS
    THE FOLLOWING FIELD : IDNO,NAME,MARKS AND AGE.
    READ DATA INTO THIS FILE. FIND THE AVERAGE AGE OF
    THESE TEN STUDENTS AND ALSO THE NAME OF THE STUDENT
    WHO SCORED THE MAXIMUM MARKS.

/* 46. CONVERT ALL LOWER CASE LETTERS IN A FILE TO
               UPPER CASE LETTERS.

/* 47. WRITE A C PROGRAM TO COPY THE CONTENTS OF ONE FILE
       TO ANOTHER.
*/        
/*49. WRITE A C PROGRAM TO APPEND A FILE */


/* 50. CONSIDER TWO SORTED FILES FILE1 AND FILE2. WRITE A PROGRAM
   TO GENERATE FILE3 WHICH IS THE RESULT OF MERGING FILE1 AND FILE2
   IN THE SORTED ORDER.
*/
           
/* 51.WRITE A C PROGRAM TO DEMONSTRATE THE WORKING OF A STACK OF
    SIZE N USING AN ARRAY.THE ELEMENTS OF THE STACK MAY BE
    ASSUMED TO BE OF TYPE INTEGER OR REAL. THE OPERATIONS TO BE
    SUPPORTED ARE:
    a.PUSH       b.POP  C.DISPLAY
    THE SHOULD PRINT APPROPRIATE MESSAGES FOR STACK OVERFLOW,
    STACK UNDERFLOW AND STACK EMPTY. YOU MAY WRITE SEPERATE
    FUNCTIONS TO DETECT THESE CASES.

/*59. WRITE A PROGRAM TO SIMULATE THE WORKING OF A QUEUE OF  
   NAMES USING AN ARRAY.PROVIDE THE FOLLOWING OPERATIONS:
  a.CQINSERT b.CQDELETE c.CQDISPLAY
           
           

/* 60.USING DYNAMIC VARIABLES AND POINTERS, CONSTRUCT A
   SINGLY LINKED LIST CONSISTING OF THE FOLLOWING
   INFORMATION IN EACH NODE :
   a.LINSERT-INSERTING IN FRONT OF THE LIST
   b.LDELETE-DELETING A NODE BASED ON JOB-ID
   c.LSEARCH-SEARCHING A NODE BASED ON JOB-ID
   d.LDISPLAY-DISPLAYING ALL THE NODES IN THE LIST
*/

/*61. A DEQUE IS A LIST IN WHICH ITEMS CAN BE ADDED OR DELETED FROM
  EITHER END OF THE LIST.IMPLEMENT THE WORKING OF SUCH A DEQUE OF
  INTEGERS
            /* 63.USING POINTERS AND DYNAMIC VARIABLES, CONSTRUCT A
    BINARY SEARCH TREE (BST) OF INTEGERS.
    a.GIVEN A KEY, PERFORM A SEARCH IN THE BST.IF THE KEY IS
    FOUND THEN DISPLAY "KEY FOUND", ELSE INSERT THE KEY IN BST
    b.WHILE CONSTRUCTING THE BST, DO NOT ADD ANY DUPLICATES.
    c.DISPLAY THE TREE USING ANY ONE OF THE TRAVERSAL METHODS.
/* 66. WRITE A C PROGRAM TO SORT A LIST OF N ELEMENTS OF
   INTEGER TYPES USING THE QUICK SORT ALGORITHM.
*/
           
/*67. WRITE A C PROGRAM TO SIMULATE THE WORKING OF
  TOWERS OF  HANOI PROBLEM FOR N DISC.PRINT THE NUMBER OF
  MOVES BY YOUR PROGRAM.
           
/* C PROGRAM TO PRINT ASCII CODES */

* C PROGRAM TO PRINT BIOSKEY */


            

0 comments:

Post a Comment