Page 17 of 93
JAWAHARLAL NEHRU TECHNOLOGICAL UNIVERSITY
I Year B.Tech. ITT P C
COMPUTER PROGRAMMING LAB
To make the student learn a programming language.
To teach the student to write programs in C solve the problems
To Introduce the student to simple linear and non linear data structures such as lists, stacks, queues, trees and graphs.
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 user.
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 form 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 larges 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 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.