Вы находитесь на странице: 1из 5

C Assignments /1. Write a program to maintain a singly linked list having the following functions: a.

Creation of the list b. Displaying the list. c. Traverse through the linked list and subtract two consecutive nodes. The result should be inserted just before the nodes subtracted. E.g.: 4 15 8 14 2 6 Output: -11 4 15 -6 8 14 -4 2 6 /2. Write a program to maintain a doubly linked list having the following functions: a. Creation of the list. b. Adding node at the end of the list. c. Displaying the list by traversing from both ends. /3. Write a program to maintain a singly linked list having the following functions: a. Creation of the list b. Displaying the list. c. Prompt the user for a position, and then detach a node from that position. Now ask the user for a new position and attach the detached node into specific position. 4. Program to write even and odd integers into different files. /5. Write a program that will scan Numeric keys from the console with following conditions a. Read this input in a string. b. Convert this floating-point value (contained in a string) into a float type variable. c. Program must allow floating point numbers only. d. It must allow only one decimal point in that input. If user tries to enter second or more decimal point nothing should happen on screen /6. Write a program to find sum of following series. x-x /2!+x/4!-x/6!+. Do not use more than one loop and function POW should not be used. /7. Define a structure to represent time in hours (0-23), minutes (0-59), and seconds (0-59), and then write a function that accepts an argument of type time represented by this structure and updates it by one second & 30 seconds. 8. Write a program to remove trailing blanks and tabs from each line of input, and to delete entirely blank lines. 9. Write a program to print the following output 1 2 2 3 3 3 4 4 4 4 5 5 5 5 5 4 4 4 4 3 3 3 2 2 1 10. Write a menu driven program in c

than one

a. to multiply any two numbers without using * (asterisk) b. to check whether given number x is equal to the value 2 POWER i or something. [Hint: where i>=0 using BITWISE operators ONLY.] 11. Write a program to print the following output 1 232 34543 4567654 567898765 67890109876 7890123210987 890123454321098 90123456765432109 0123456789876543210 12. Write a program to find sum of following series. x-x /3!+(x)5/5!-(x)7/7!+. Do not use more than one loop and function POW should not be used. /14. Write a program that receives the month and year from the keyboard as integer and prints the calendar in the following format. Jan, 2008 Sunday Monday Tuesday Wednesday Thursday Friday Saturday 1 2 3 4 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 Consider 01/01/1900 was Monday. With this as the calendar should be generated. /15. Write a menu driven program the depicts the working of a library. The menu option should be: 1. Add book information 2. Display book information 3. List the count of the books in the library 4. Exit /16. There are 10 records present in a file with the following structure: struct { char itemcode[6]; char itemname [20]; int qty; }; Write a program to read these records and display them in ascending order on the field item name and write them into a text file in ascending order. /17. Write a program to maintain a doubly linked list having the following functions: a. Creation of the list. b. Displaying the list by traversing from both ends. c. Counting the number of nodes in the list.

18. Write a function to generate the following pyramid of numbers 0 111 22222 3333333 4444444444 55555555555 444444444 3333333 22222 111 0 /19. A program is to be written to implement the tower of Hanoi Problem. 20. Get this output using simple loops. Here no of iterations are important. GFEDCBA FEDCBA EDCBA DCBA CBA BA A 21. Write a program to sort a number of strings using bubble sort. Input is a number of strings and the output is the sorted list based on the length of strings. For e.g.: If input is jyoti, sareeka, anisha, sangita, savita, suja The output is suja, jyoti, anisha, savita, sareeka, sangita /22. A hospital keeps a file of blood donors in which each record has the format: Name: 20 columns Address: 40 columns Age: 2 columns Blood Type: 1 columns (Type1, 2,3, or 4) Write a program to read the file and print a list of all blood donors whose age is below 25 and blood is type 2. 23. Write a function to generate the following pyramid of numbers. 0 101 21012 3210123 432101234 54321012345 432101234 3210123 21012 101 0

24. Write a program which reads 4 numbers a, b, c and p. Let f(x)=ax+bx+c be a function. The Program outputs the value of f(p) e.g 4 3 1 2 out put 4(2)+3(2)-1=21 25. Write a program, Which reads x1, y1, x2, y2 and d. Let P and Q be the points whose coordinates are (x1, y1) and (x2,y2) respectively. Let r be a point on the line PQ, Whose distance from P is d. Assume that the length of PQ is more than d. The program outputs coordinates of R. E.g. if input 0 0 30 40 30 output is (18,24) 26. Write a program to cyclically permute a string one character at a time. E.g.: If space is the input the output should produce queue ueueq euegu ueque equeu 27. Write a function to generate the following pyramid of numbers 0 111 22222 3333333 4444444444 55555555555

28. Write a program to replace a particular word by another word in a given string. For example, the word PASCAL should be replaced by C in the text It is good to program in PASCAL language. /29. Add commands to print the top element of the stack without Popping, to duplicate it and to swap the top two elements. Add a command to clear the stack. /30. Write a program to maintain a singly linked list having the following functions: a. Creation of the list b. Displaying the list. c. Traverse through the linked list and add two consecutive nodes. The result should be inserted just before the nodes added. E.g.: 5 15 8 9 2 6 Output: 17 2 15 17 89 18 12 6 31. Get this output using simple loops. Here no of iterations are important. Z zyz zyxyz zyxwxyz zyxwvwxyz zyxwxyz zyxyz zyz z

32. Get this output using simple loops. Here no of iterations are important. 0 101 31013 5310135 753101357 97531013579 753101357 5310135 31013 101 0 33. Get this output using simple loops. Here no of iterations are important 1 2222 333333 44444444 5555555555 34. Write a menu driven program in C, which consists following option? a. To find the second biggest using array b. To smallest of N numbers using array /35. Write a C program that will accept a hexadecimal number as input, and then display a menu that will permit any of the following operations to be carried out. a. Display hexadecimal equivalent of the ones complement b. Carry out a bit shifting operation and then display hexadecimal equivalent of the result c. Exit 36. Write a program, which reads two numbers and find the sum of product of digits of the number. If Numbers are 224 and 37 then Answer is 2*3+2*7+2*3+2*7+4*3+4*7=80 37. Write a program, which reads two numbers and find the sum of product of digits of the number. If Numbers are 224 and 37 then Answer is (2)3+(2)7+(2)3+(2)7+(4)3+(4)7=16720

Вам также может понравиться