17-12-2012, 04:08 PM
PROGRAMMING LAB WITH C
PROGRAMMING LAB.docx (Size: 12.33 KB / Downloads: 26)
1. a) Write a C program to ask the user to enter one char ( Upper-Case letter) check
whether user entered a Upper-case letter or not(by using relational and logical operators)
and then if user has entered a Upper-case letter convert into a Lower-case letter? ( hint:
Upper-case means capital letters, use ASCII information to check for Upper-case and
convert)
b) Write a C program to ask the user to enter two integers and apply all arithmetic
operations on those print the corresponding values? (Hint: +,-,*, /, %)
c) Write a C program to Determine the ranges of char, short, int and long int variables
both signed and unsigned
(i) By using sizeof operator(ii) By printing appropriate values from standard header
(limits.h )
2. a) Write a Program to Find the Roots of a Quadratic Equation using if else and Switch
statements.
b) Write a Program which Generates One Hundred Random Integers in the Range of
1 To 100, store them in an array and then prints the average. Write three versions of the
program using Different Loop Constructs.
3. 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 calculate the following
Sum=1-x2/2! +x4/4!-x6/6!+x8/8!-x10/10!
4. a) Write a C program to generate all the prime numbers between 1 and n, where n is a value supplied by the user.
b) 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.
5. a) Write a C program to find both the largest and smallest number in a list of integers.
b) Write a program to read set of elements in the array and sort them in ascending order.
c) Write a C program that uses functions to perform the following:
i) Addition of Two Matrices
ii) Multiplication of Two Matrices
iii) Transpose of a given Matrix
6. 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
c) Given an Array of Strings Write a Program to Sort the String in Dictionary Order.
7. 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
8. Write a C program that uses functions to perform the following operations:
a)Count number of characters, words in a file.
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.)
c) Write a C program which copies one file to another.