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
-
- Write a C program to find the factorial of a positive integer.
- Write a C program to find the roots of a quadratic equation.
-
- Write a C program to determine if the given number is a prime number or not.
- 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.
-
- Write a C program to construct a pyramid of numbers.
- Write a C program to calculate the following Sum: Sum = 1 - x2/2! + x4/4! - x6/6! + x8/8! - x10/10!
-
- 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)
- 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.
-
- Write C program that reads two integers x and n and calls a recursive function to compute xn
- Write a C program that uses a recursive function to solve the Towers of Hanoi problem.
- Write a C program that reads two integers and calls a recursive function to compute ncr value.
-
- 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.
- 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.
-
- 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.
- 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.
-
- Write a C program that implements the Bubble sort method to sort a given list of integers in ascending order.
- Write a C program that reads two matrices and uses functions to perform the following:
- Addition of two matrices
- Multiplication of two matrices
-
- Write a C program that uses functions to perform the following operations:
- to insert a sub-string into a given main string from a given position.
- to delete n characters from a given position in a given string.
- Write a C program that uses a non recursive function to determine if the given string is a palindrome or not.
- Write a C program that uses functions to perform the following operations:
-
- Write a C program to replace a substring with another in a given line of text.
- 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.
-
- 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.
- Write a C program to convert a positive integer to a roman numeral. Ex. 11 is converted to XI.
-
- Write a C program to display the contents of a file to standard output device.
- Write a C program which copies one file to another, replacing all lowercase characters with their uppercase equivalents.
-
- 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.
- Write a C program to compare two files, printing the first line where they differ.
-
- Write a C program to change the nth character (byte) in a text file. Use fseek function.
- 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.
-
- 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).
- 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:
- Mastering C, K.R. Venugopal and S.R. Prasad, TMH Publishers.
- Computer Programming in C, V. Rajaraman, PHI.
- Programming in C, Stephen G. Kochan, Fourth Edition, Pearson Education.
- 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
-
- Write a C program to find the factorial of a positive integer.
- Write a C program to find the roots of a quadratic equation.
-
- Write a C program to determine if the given number is a prime number or not.
- 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.
-
- Write a C program to construct a pyramid of numbers.
- Write a C program to calculate the following Sum: Sum = 1 - x2/2! + x4/4! - x6/6! + x8/8! - x10/10!
-
- 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)
- 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.
-
- Write C program that reads two integers x and n and calls a recursive function to compute xn
- Write a C program that uses a recursive function to solve the Towers of Hanoi problem.
- Write a C program that reads two integers and calls a recursive function to compute ncr value.
-
- 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.
- 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.
-
- 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.
- 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.
-
- Write a C program that implements the Bubble sort method to sort a given list of integers in ascending order.
- Write a C program that reads two matrices and uses functions to perform the following:
- Addition of two matrices
- Multiplication of two matrices
-
- Write a C program that uses functions to perform the following operations:
- to insert a sub-string into a given main string from a given position.
- to delete n characters from a given position in a given string.
- Write a C program that uses a non recursive function to determine if the given string is a palindrome or not.
- Write a C program that uses functions to perform the following operations:
-
- Write a C program to replace a substring with another in a given line of text.
- 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.
-
- 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.
- Write a C program to convert a positive integer to a roman numeral. Ex. 11 is converted to XI.
-
- Write a C program to display the contents of a file to standard output device.
- Write a C program which copies one file to another, replacing all lowercase characters with their uppercase equivalents.
-
- 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.
- Write a C program to compare two files, printing the first line where they differ.
-
- Write a C program to change the nth character (byte) in a text file. Use fseek function.
- 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.
-
- 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).
- 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:
- Mastering C, K.R. Venugopal and S.R. Prasad, TMH Publishers.
- Computer Programming in C, V. Rajaraman, PHI.
- Programming in C, Stephen G. Kochan, Fourth Edition, Pearson Education.
- C++: The complete reference, H. Schildt, TMH Publishers.
-
CreatedDec 15, 2016
-
UpdatedDec 16, 2016
-
Views5,134