Note: This syllabus is common for Civil, ME, AE, ME (M), MME, AU, Mining, Petroleum, CEE, ME (Nanotech).

COMPUTER PROGRAMMING IN C LAB
B.Tech. I Year I Sem. L T/P/D C
Course Code: CS108ES/CS208ES 0 0/3/0 2


Course Objective:

  • To write programs in C using structured programming approach to solve the problems.

Course Outcomes:

  • Ability to design and test programs to solve mathematical and scientific problems.
  • Ability to write structured programs using control structures and functions.

Recommended Systems/Software Requirements:

  • Intel based desktop PC
  • GNU C Compiler
  1.  
    1. Write a C program to find the factorial of a positive integer.
    2. Write a C program to find the roots of a quadratic equation.
  2.  
    1. Write a C program to determine if the given number is a prime number or not.
    2. A Fibonacci sequence is defined as follows: the first and second terms in the sequence are 0 and 1. Subsequent terms are found by adding the preceding two terms in the sequence. Write a C program to generate the first n terms of the sequence.
  3.  
    1. Write a C program to construct a pyramid of numbers.
    2. Write a C program to calculate the following Sum: Sum = 1 - x2/2! + x4/4! - x6/6! + x8/8! - x10/10!
  4.  
    1. The least common multiple (LCM) of two positive integers a and b is the smallest integer that is evenly divisible by both a and b. Write a C program that reads two integers and calls LCM (a, b) function that takes two integer arguments and returns their LCM. The LCM (a, b) function should calculate the least common multiple by calling the GCD (a, b) function and using the following relation: LCM(a, b) = ab / GCD(a, b)
    2. Write a C program that reads two integers n and r to compute the ncr value using the following relation: ncr (n, r) = n! / r! (n-r)! . Use a function for computing the factorial value of an integer.
  5.  
    1. Write C program that reads two integers x and n and calls a recursive function to compute xn
    2. Write a C program that uses a recursive function to solve the Towers of Hanoi problem.
    3. Write a C program that reads two integers and calls a recursive function to compute ncr value.
  6.  
    1. Write a C program to generate all the prime numbers between 1 and n, where n is a value supplied by the user using Sieve of Eratosthenes algorithm.
    2. Write a C program that uses non recursive function to search for a Key value in a given list of integers. Use linear search method.
  7.  
    1. Write a menu-driven C program that allows a user to enter n numbers and then choose between finding the smallest, largest, sum, or average. The menu and all the choices are to be functions. Use a switch statement to determine what action to take. Display an error message if an invalid choice is entered.
    2. Write a C program that uses non recursive function to search for a Key value in a given sorted list of integers. Use binary search method.
  8.  
    1. Write a C program that implements the Bubble sort method to sort a given list of integers in ascending order.
    2. Write a C program that reads two matrices and uses functions to perform the following:
      1. Addition of two matrices
      2. Multiplication of two matrices
  9.  
    1. Write a C program that uses functions to perform the following operations:
      1. to insert a sub-string into a given main string from a given position.
      2. to delete n characters from a given position in a given string.
    2. Write a C program that uses a non recursive function to determine if the given string is a palindrome or not.
  10.  
    1. Write a C program to replace a substring with another in a given line of text.
    2. Write a C program that reads 15 names each of up to 30 characters, stores them in an array, and uses an array of pointers to display them in ascending (ie. alphabetical) order.
  11.  
    1. 2’s complement of a number is obtained by scanning it from right to left and complementing all the bits after the first appearance of a 1. Thus 2’s complement of 11100 is 00100. Write a C program to find the 2’s complement of a binary number.
    2. Write a C program to convert a positive integer to a roman numeral. Ex. 11 is converted to XI.
  12.  
    1. Write a C program to display the contents of a file to standard output device.
    2. Write a C program which copies one file to another, replacing all lowercase characters with their uppercase equivalents.
  13.  
    1. Write a C program to count the number of times a character occurs in a text file. The file name and the character are supplied as command-line arguments.
    2. Write a C program to compare two files, printing the first line where they differ.
  14.  
    1. Write a C program to change the nth character (byte) in a text file. Use fseek function.
    2. Write a C program to reverse the first n characters in a file. The file name and n are specified on the command line. Use fseek function.
  15.  
    1. Write a C program to merge two files into a third file (i.e., the contents of the firs t file followed by those of the second are put in the third file).
    2. Define a macro that finds the maximum of two numbers. Write a C program that uses the macro and prints the maximum of two numbers.

Reference Books:

  1. Mastering C, K.R. Venugopal and S.R. Prasad, TMH Publishers.
  2. Computer Programming in C, V. Rajaraman, PHI.
  3. Programming in C, Stephen G. Kochan, Fourth Edition, Pearson Education.
  4. C++: The complete reference, H. Schildt, TMH Publishers.

Note: This syllabus is common for EEE, ECE, CSE, EIE, BME, IT, ETE, ECM, ICE.

CS108ES/CS208ES: COMPUTER PROGRAMMING IN C LAB
B.Tech. I Year II Sem. L T/P/D C
0 0/3/0 2


Course Objective:

  • To write programs in C using structured programming approach to solve the problems.

Course Outcomes:

  • Ability to design and test programs to solve mathematical and scientific problems.
  • Ability to write structured programs using control structures and functions.

Recommended Systems/Software Requirements:

  • Intel based desktop PC
  • GNU C Compiler
  1.  
    1. Write a C program to find the factorial of a positive integer.
    2. Write a C program to find the roots of a quadratic equation.
  2.  
    1. Write a C program to determine if the given number is a prime number or not.
    2. A Fibonacci sequence is defined as follows: the first and second terms in the sequence are 0 and 1. Subsequent terms are found by adding the preceding two terms in the sequence. Write a C program to generate the first n terms of the sequence.
  3.  
    1. Write a C program to construct a pyramid of numbers.
    2. Write a C program to calculate the following Sum: Sum = 1 - x2/2! + x4/4! - x6/6! + x8/8! - x10/10!
  4.  
    1. The least common multiple (LCM) of two positive integers a and b is the smallest integer that is evenly divisible by both a and b. Write a C program that reads two integers and calls LCM (a, b) function that takes two integer arguments and returns their LCM. The LCM (a, b) function should calculate the least common multiple by calling the GCD (a, b) function and using the following relation: LCM(a, b) = ab / GCD(a, b)
    2. Write a C program that reads two integers n and r to compute the ncr value using the following relation: ncr (n, r) = n! / r! (n-r)! . Use a function for computing the factorial value of an integer.
  5.  
    1. Write C program that reads two integers x and n and calls a recursive function to compute xn
    2. Write a C program that uses a recursive function to solve the Towers of Hanoi problem.
    3. Write a C program that reads two integers and calls a recursive function to compute ncr value.
  6.  
    1. Write a C program to generate all the prime numbers between 1 and n, where n is a value supplied by the user using Sieve of Eratosthenes algorithm.
    2. Write a C program that uses non recursive function to search for a Key value in a given list of integers. Use linear search method.
  7.  
    1. Write a menu-driven C program that allows a user to enter n numbers and then choose between finding the smallest, largest, sum, or average. The menu and all the choices are to be functions. Use a switch statement to determine what action to take. Display an error message if an invalid choice is entered.
    2. Write a C program that uses non recursive function to search for a Key value in a given sorted list of integers. Use binary search method.
  8.  
    1. Write a C program that implements the Bubble sort method to sort a given list of integers in ascending order.
    2. Write a C program that reads two matrices and uses functions to perform the following:
      1. Addition of two matrices
      2. Multiplication of two matrices
  9.  
    1. Write a C program that uses functions to perform the following operations:
      1. to insert a sub-string into a given main string from a given position.
      2. to delete n characters from a given position in a given string.
    2. Write a C program that uses a non recursive function to determine if the given string is a palindrome or not.
  10.  
    1. Write a C program to replace a substring with another in a given line of text.
    2. Write a C program that reads 15 names each of up to 30 characters, stores them in an array, and uses an array of pointers to display them in ascending (ie. alphabetical) order.
  11.  
    1. 2’s complement of a number is obtained by scanning it from right to left and complementing all the bits after the first appearance of a 1. Thus 2’s complement of 11100 is 00100. Write a C program to find the 2’s complement of a binary number.
    2. Write a C program to convert a positive integer to a roman numeral. Ex. 11 is converted to XI.
  12.  
    1. Write a C program to display the contents of a file to standard output device.
    2. Write a C program which copies one file to another, replacing all lowercase characters with their uppercase equivalents.
  13.  
    1. Write a C program to count the number of times a character occurs in a text file. The file name and the character are supplied as command-line arguments.
    2. Write a C program to compare two files, printing the first line where they differ.
  14.  
    1. Write a C program to change the nth character (byte) in a text file. Use fseek function.
    2. Write a C program to reverse the first n characters in a file. The file name and n are specified on the command line. Use fseek function.
  15.  
    1. Write a C program to merge two files into a third file (i.e., the contents of the firs t file followed by those of the second are put in the third file).
    2. Define a macro that finds the maximum of two numbers. Write a C program that uses the macro and prints the maximum of two numbers.

Reference Books:

  1. Mastering C, K.R. Venugopal and S.R. Prasad, TMH Publishers.
  2. Computer Programming in C, V. Rajaraman, PHI.
  3. Programming in C, Stephen G. Kochan, Fourth Edition, Pearson Education.
  4. C++: The complete reference, H. Schildt, TMH Publishers.
  • Created
    Dec 15, 2016
  • Updated
    Dec 16, 2016
  • Views
    4,994