Skip to content
This repository has been archived by the owner on Oct 27, 2022. It is now read-only.

rpandox/C-programming_sem1-KEC

Repository files navigation

lab_sem1-KEC

This is the Laboratory sesson for KEC SEM-1

it is done using (C-programming Language)

LABORATORY SESSON 1 - Basic Input Output

    one
        # a program using printf () and different escape sequences to give the output

                First Name      Middle name     Marks 
                ............    ............    ...... 
                        NOTE : < 30 'Fail' 
                            \\"END"// 
    
    two
        # a program which requests a user to enter a weight in kg. 
          The program converts it in pounds (kg = 2.2 pounds)
    
    three
        # a program to read three numbers x, y and z to compute the values of a, b and c given by:
            a) a = x+|y -z|     b)  b = sin^-1(√((x^2 + y^2)/2))    c) c = (x-z)^4/3
    
    four
        # a program to accept temperature in Fahrenheit and convert it into degrees Celsius
    
    five
        # a program to read the radius of a circle and to compute its area and circumference. 
          Used a symbolic constant to define the value of π.

LABORATORY SESSON 2 - Selective Structures

    one
        # a program that reads a co-ordinate point of rectangle coordinate system and displays the
          the appropriate message after checking where the point lies on the co-ordinate system.
    
    two 
        # a program to find the taxable amount of an employee.

            a. No tax up to 1,00,000 per annual income
            b. 15% tax for 1,00,000 to 1,75,000 per annual income
            c. 25% tax for greater than 1,75,000 per annual income
    
    three
        # a program to read a positive integer n and check weather a number is 
          odd or even using switch case

LABORATORY SESSON 3 - Selective Structures (2nd part)

    one
        # a program for department store to display a list of 3 items, their price lists; 
          accept customer’s option and print the cost of the goods, when the required quantity is 
          entered as inputs. Using switch case
                A typical interaction may be as follows:
                DEPARTMENTAL STORE 
                S.N.    Item    Price(Rs.)
                1       Bread   30
                2       Jam     90
                3       Butter  120
            Please enter your choice(1,2 or 3): 1   
            Quantity(nos.): 3
            The total cost of your choice will be Rs. 90.
    
    two 
        # a program to test whether a given year is a leap year

    three 
        # a program to find the roots of a quadratic equation ax + bx + c = 0. The program must 
          first show whether the roots are real and unequal, real and equal or complex conjugates. In 
          case of complex roots, the roots must be displayed in the form  x + yi , x - yi .

LABORATORY SESSON 4 - Iterative Structures

one 
    # a program to take positive integers as input until 0 is entered and compute the average of 
      even numbers entered by the user.

two
    # a program to check if a number is triangular or not. 
      (e.g. 3 = 1+2, 6 = 1+2+3, 10 = 1+2+3+4,.....)

three
    # a program to display the given sequence up to nth term.
        1, 2, 5, 10, 17, 26 ....... nth term

four 
    #  a program to compute the sum of the given series up to nth term.
        1 – x^2 + x^4 – x^6 + x^8 - ......... nth term
five
    # a program to display following the patterns:
        a) 1                             b) PROGRAMMING
          121                                ROGRAMMIN
         12321                                OGRAMMI
        1234321                                GRAMM
       123454321                                RAM
        ......                                   A

LABORATORY SESSON 5 - Functions

one
    # a program to create a user defined function that finds the factorial of a number entered 
      by the user which takes argument. The result must be displayed in the main function.

two
    # a program to create a number of user defined functions that takes arguments to find the 
      areas of rectangle and circle. The result must be displayed from main.

three
    # a program to calculate the permutation and combination for given n and r. The permutation 
      and combination are defined for given n and r as:
        P(n, r) = n!/(n-r)!
        C(n, r) = P(n,r)/r!
        Define a function factorial, P and C to calculate above requirements.

four
    # a program to swap the values of two numbers.

LABORATORY SESSON 6 - Recursive Functions

one
    # a program to find the sum of natural numbers up to the number given by the user 
      using recursion.

two
    # a program to find the factorial of the given number using
    recursion.

three
    # a program to display the Fibonacci series (0 1 1 2 3 5 8 ..... up to given number of terms) 
      using recursion.

four
    # a program to calculate the sum of the digits of given integer up to single digit 
      using recursion.
five
    # a program to convert the decimal number given by the user into binary using recursion.

LABORATORY SESSON 7 - Arrays (1D and 2D)

one
    # a program to read ‘n’ numbers and to sort them in the ascending order.

two
    # a program to read the numbers in an array and reverse the order of the elements.

three
    # a program to find the transpose of a given matrix.

four
    # a program to read two matrices of numbers and to find their product. Use 2D-array 
      to represent matrices and use a function to multiply them.

LABORATORY SESSON 8 - Strings and Pointers

one
    # a program to read two strings in main and compare them using user defined function. Display 
      appropriate message from main.

two
    # a program to read a line of text and to count the number of vowels, consonants, white spaces,
      digits and special characters in it. Use a character array to store the line.

three
    # a program to read ‘n’ words and use user defined function to arrange and display them in 
      the alphabetical order.

four
    # a program to find the larger of two numbers using the concept of function and pointers.

five
    # a program to illustrate the concept of pointer expressions.

six
    # a program to illustrate the concept of pointer to pointer.

LABORATORY SESSON 9 - Structures

one
    # a program to create a structure Length to store length in feet & inches 
      and read two lengths and display their sum and difference.

two
    # a program to create a structure in C to store the name of a batsman, runs scored, number of
      dismissals and batting average. In the program, read the data(name, runs and no. of dismissals)
      of five players and display the batting average of the player whose name is entered by the user. 
      Batting average is given by total runs/total no. of dismissals.

three
    # a program to create a structure Student to store the name of student, roll number & marks 
    and read the details of five students and display the name and roll no. of the student with 
    highest marks.

LABORATORY SESSON 10 - Structures using Functions and Pointers

one
    # a program to create a structure address(with members Province number, District, town) 
    and person(with members name, phone no., address) to store data of 5 people. Display the 
    people with the searched Province number. Use function.

two
    # a program to read name and age as the two members of a structure named Students for 5 
    different students. Make two functions, first function to sort the data according to 
    their name alphabetically and second function to sort the data according to their age.
    Display the result of both functions from main.

three
    # a program to input name, post and salary of 5 employees from main() function and pass
     to structure type user defined function(arguments of this function should also be a 
     structure type). This function returns structure variable which keeps the record of 
     only those employees whose salary is greater than 10,000. This modified record is also 
     displayed from main() function.

LABORATORY SESSON 11 - Files

one
    # a program to read the characters from user until the user enters comma character (,) 
    and store it in a file. Display the content stored in a file on the screen.

two
    # a program that writes something in the source file, copies the content of the source 
    file to the destination file and displays the content in the destination file on the screen.

three
    # a program to continuously read name, age and salary of a worker and write it into a 
    file until user confirms to end. Then read n from user and display the nth record in the file. 
    Details of worker must be represented by a structure.

About

This is the lab for KEC SEM-1

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages