JNTU B Tech Syllabus Computer Programming Lab
JAWAHAR LAL NEHRU TECHNOLOGICAL UNIVERSITY HYDERABAD
COMPUTER PROGRAMMING LAB
· To make the student learn a programming language.
· To teach the student to write programs in C to solve the problems.
· To Introduce the student to simple linear data structures such as lists, stacks, queues.
Recommended Systems/Software Requirements:
· Intel based desktop PC
· ANSI C Compiler with Supporting Editors
a) Write a C program to find the sum of individual digits of a positive integer.
b) 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.
c) Write a C program to generate all the prime numbers between 1 and n, where n is a value supplied by the
a) Write a C program to calculate the following Sum:
b) Write a C program toe find the roots of a quadratic equation.
a) Write C programs that use both recursive and non-recursive functions
i) To find the factorial of a given integer.
ii) To find the GCD (greatest common divisor) of two given integers.
iii) To solve Towers of Hanoi problem.
a) The total distance travelled by vehicle in ‘t’ seconds is given by distance = ut+1/2at2 where ‘u’ and ‘a’
are the initial velocity (m/sec.) and acceleration (m/sec2). Write C program to find the distance travelled at
regular intervals of time given the values of ‘u’ and ‘a’. The program should provide the flexibility to the user
to select his own time intervals and repeat the calculations for different values of ‘u’ and ‘a’.
b) Write a C program, which takes two integer operands and one operator from the user, performs the
operation and then prints the result. (Consider the operators +,-,*, /, % and use Switch Statement)
a) Write a C program to find both the largest and smallest number in a list of integers.
b) Write a C program that uses functions to perform the following:
i) Addition of Two Matrices
ii) Multiplication of Two Matrices
a) Write a C program that uses functions to perform the following operations:
i) To insert a sub-string in to a given main string from a given position.
ii) To delete n Characters from a given position in a given string.
b) Write a C program to determine if the given string is a palindrome or not
a) Write a C program that displays the position or index in the string S where the string T begins, or – 1 if S
doesn’t contain T.
b) Write a C program to count the lines, words and characters in a given text.
a) Write a C program to generate Pascal’s triangle.
b) Write a C program to construct a pyramid of numbers.
Write a C program to read in two numbers, x and n, and then compute the sum of this geometric
For example: if n is 3 and x is 5, then the program computes 1+5+25+125.
Print x, n, the sum
Perform error checking. For example, the formula does not make sense for negative exponents – if n is less
than 0. Have your program print an error message if n<0, then go back and read in the next pair of numbers
of without computing the sum. Are any values of x also illegal ? If so, test for them too.
a) 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.
b) Write a C program to convert a Roman numeral to its decimal equivalent.
Write a C program that uses functions to perform the following operations:
i) Reading a complex number
ii) Writing a complex number
iii) Addition of two complex numbers
iv) Multiplication of two complex numbers
(Note: represent complex number using a structure.)
a) Write a C program which copies one file to another.
b) Write a C program to reverse the first n characters in a file.
(Note: The file name and n are specified on the command line.)
a) Write a C programme to display the contents of a file.
b) Write a C programme to merge two files into a third file ( i.e., the contents of the first file followed by
those of the second are put in the third file)
Write a C program that uses functions to perform the following operations on singly linked list.:
i) Creation ii) Insertion iii) Deletion iv) Traversal
Write C programs that implement stack (its operations) using
i) Arrays ii) Pointers
Write C programs that implement Queue (its operations) using
i) Arrays ii) Pointers
Write a C program that uses Stack operations to perform the following:
i) Converting infix expression into postfix expression
ii) Evaluating the postfix expression
Write a C program that implements the following sorting methods to sort a given list of integers in ascending
i) Bubble sort
ii) Selection sort
Write C programs that use both recursive and non recursive functions to perform the following searching
operations for a Key value in a given list of integers :
i) Linear search ii) Binary search
Write C program that implements the following sorting method to sort a given list of integers in ascending
i) Quick sort
Write C program that implement the following sorting method to sort a given list of integers in ascending
i) Merge sort
Write C programs to implement the Lagrange interpolation and Newton- Gregory forward interpolation.
Write C programs to implement the linear regression and polynomial regression algorithms.
Write C programs to implement Trapezoidal and Simpson methods.
1. C programming and Data Structures, P. Padmanabham, Third Edition, BS Publications
2. Mastering C, K.R. Venugopal and S.R. Prasad, TMH Publications.
3. The Spirit of C, an introduction to modern programming, M.Cooper, Jaico Publishing House.
4 Practical C Programming,Steve Oualline,O’Reilly,SPD. TMH publications.
5. Computer Basics and C Programming, V. Rajaraman, PHI Publications.
6. Data structures and Program Design in C,R.Kruse,C.L.Tondo,B.P.Leung,M.Shashi,Pearson Education.