C Assignments
C Assignments
============
INITIAL PROGRAMS
4. Take two variables and swap their contents using third temporary
variable.
5. Take two variables and swap their contents without using third
temporary variable.
6. Take a four digit number from the user print its reverse.
7. Take a four digit number from the user and print the sum of
the digits.
8. Take a three digit number from the user and print the sum of
first and last digit.
9. Take the marks of five subjects and calculate the total and the
average and print it.
10. Take the radius of the circle and claculate the area of the circle.
EXERCISE 2
============
1. Take the marks of five subejcts calculate the total and the
average and on the basis of average decide the grade of the student.
0 - 34 % Fail
35 - 45 % Third grade
45 - 60 % Second grade
60 - 75 % Third grade
75 onwards Distinction.
4. Find out the Largest among three numbers without using the
logical operators.
5. Find out the largest among three numbers using the logical operator.
6. Take number of items and the price per item from the user and
calculate the bill, if total amount is more than 1000 then
give 10% discount else no discount, Display the bill.
7. Take the basic salary from the user if basic salary is less
than or equal to 2000 then
DA=40% and HRA is 20%
if basic salary is greater than 2000 then
DA=60% and HRA is 40%,
Calculate the gross salary.
EXERCISE 3
============
SWITCH - CASE
1. Take the number from the user upto 10 and print it in words.
2. Take the character from the user and print whether the
entered character is vowel or consonent. (Programme should be
applicable for both the cases i.e. Upper and Lower case);
3. Take two numbers from the user and show him the menu of the
operations to be performed on these two numbers and ask his
choice, operate and display the result.
4. Modify the above programme, instead of showing the menu to the user
ask him to enter the operator, and operate accordingly.
6. Take any four digit number from the user and print it in words.
(Programme should be applicable for all the numbers upto 9999).
7. Take the month number from the user and print the corresponding month.
8. Take the month number from the user and print the season occuring
in that month.
EXERCISE 4
============
1. Take the number from the user and print it in reverse order.
2. Take the number from the user and print the sum of the digits.
5. Take the number from the user and check whether the entered number
is prime or not.
8. Take the number from the user and check whether the given number
is an Armstrong number or not.
(Armstrong number is the number whose sum of the cube of digits
is equal to the number itself).
10. Take the number from the user and generate the table of given number.
12. Take the number from the user and reverse it and check whether
it is same as the number.
13. Take ten numbers from the user and print the smallest and the
largest among them.
14. Print the series of numbers upto 10000 whose sum and the product
of the digits is same.
EXERCISE 5
============
ARRAYS
1. Take the input of 10 numbers from the user and print those numbers.
2. Take the input of 10 numbers from the user and print those numbers
in the reverse order.
3. Take the input of 10 numbers from the user find the smallest
and the largest number among these numbers.
4. Take the input of 10 numbers from the user and print those numbers
in the ascending order.
5. Take two arrays from the user and add them and store the result
in the third array.
6. Take the input of 10 numbers from the user and print square
of the numbers in the same array.
7. Take two numbers from the user and find the HCF of the numbers.
8. Take the input of 10 numbers from the user and print how many
positive, negative, even and odd numbers are present in the
given array.
11. Take the number from the user and convert it into it's
binary equivalent.
EXERCISE 6
============
1. Take two matrices of 3 x 3 order and add them and store in the
third matrix.
2. Take two matrices of 3 x 3 order and subtract them and store in the
third matrix.
4. Take two matrices of 3 x 3 order and multiply them and store in the
third matrix.
6. Take one matrix of any order and print the transpose of the
given matrix.
EXERCISE 7
============
STRINGS
1. Take two strings from the user and concatenate these two strings
using the inbuilt function.
2. Take two strings from the user and compare these two strings
whether they are equal or not using the inbuilt function.
3. Take a string from the user and print the reverse of the string
using the inbuilt function.
4. Take one string from the user and copy it into another string
variable and print the copied string.
4. Take one string from the user and check whether the given string
is palindrome or not.
6. Take two strings and check whether they are of equal length or
not.
EXERCISE 8
============
POINTERS
1. Create a variable and assign it some value then print the value
address of that variable and the value at that address.
2. Take two numbers from the user and add them using the pointers
and print the result.
(Don't use name of variables even in scanf and printf statements
only use pointers.)
3. Take two numbers from the user and swap them using the pointers.
6. Take the string from the user and reverse that string with the
help of the pointers.
7. Take two strings from the user and concatenate these strings
using pointers.
8. Take two strings from the user and compare these strings whether
they are equal or not using pointers.
EXERCISE 9
============
FUNCTIONS
1. Send the number into the function and print the Cube of a number
in the function itself.
2. Send the number into the function and print the Cube of a number
in the main function.
3. Send the radius of the circle in the function and print the area
area of that circle in the main function.
9. Take two 3 x 3 matrices from the user and send it to the function
and print the multiplication of the matrices in the function.
10. Take two numbers from the user and swap them in the function and print
the swapped values in the function.
11. Take two numbers from the user and swap them in the function and print
the swapped values in the main function.
EXERCISE 10
=============
STRUCTURES
1. Create the structure of a student and take all details and print
it on the screen with the help of the normal variable.
2. Create the structure of an employee and take all details and print
it with the help of the pointer variable of the structure.
3. Create the structure of a book and take all details and print
it with the help of the array varaible of the structure.
EXERCISE 11
=============
FILE HANDLING
1. Create a file on the DOS using dos commnads and write few lines
in that file.
Read the file through a C program.
2. Create a file with the C program and read the contents with the
help of C program.
3. Create a file, write few lines in the file and the contents into
another file.
7. Take the name of book, name of author, number of pages and price of
the book for five different books and store it in the file.
Ask the user which book he wants, then check in the file whether the
book is present, if present display all the details of the book, else
display the message, book not present.
EXERCISE 12
=============
DATA STRUCTURE
1. Create the STACK and demonstrate the operation of PUSH and POP
in it.
4. In the above programme list all the employees whose basic salary is
more than 5000.
5. For the above programme take the name of employee from the user
and check whether the given employee is present in the list or
not, if present display all the details, else give message
emoployee not present.
=============================================================================