PROGRAMMING FOR PROBLEM SOLVING LAB
1. Write a simple program that prints the results of all the operators available in C (including pre/ post increment, bitwise and/or/ not, etc.). Read required operand values from standard input.
2. Write a simple program that converts one given data type to another using auto conversion and casting. Take the values form standard input.
5.
Write program that declares Class awarded for a givenpercentage of marks, where mark
<40%= Failed, 40% to <60% = Second class, 60% to <70%=First class,
>= 70% = distinction. Read percentage from standard input.
6.
Write a program that prints a multiplication table fora given number and the number of rows in the table. For example, for a number 5
and rows = 3, the output should be:
5 x 1 = 5
5 x 2 = 10
5 x 3 = 15 ……………..
7. 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).
8. Write a program that findsif a given number is a prime number.
9. Write a C program to find the minimum, maximum andaverage in an array of integers.
10.Write a C program to perform the following:
11. Write a program for reading elements using pointerinto array and display the values
using array.
12. Write a program for display values reverse order from array using pointer.
13 Write a program through
pointer variable to sum of n elements from array.
14. Write a C program to convert a Roman numeral rangingfrom I to L to its decimal equivalent.
15. Write a C program to
construct a pyramid of numbers as follows:
1 |
* |
1 |
1 |
* |
12 |
** |
23 |
22 |
** |
123 |
*** |
456 |
333 |
*** |
|
|
|
4444 |
** * |
16. Write a C program that implements the Bubble sortmethod to sort a given list of integers in ascending order.
17. Write a C
program that sorts the given array of integers using selection sort in descending order.
18. Write a C
program that sorts the given array of integers using insertion sort in
ascending order.
19. Write a C program that uses non recursive function to
search for a Key value in a given List of integers using linear search method.
20. Write a C program that uses non recursive function to
search for a Key value in a given Sorted list of integers using binary search method.
22. Write a program that shows the binary equivalent of a given positive number
between 0 to 255.
between 0 to 255.
23. Write a C program to find the sum of individual digits of a positive integer and test given number is palindrome.
24. 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.
25. Write a C program to generate all the prime numbers between 1 and n, where n is a value supplied by the user.
26. Write a C program to find the roots of a Quadratic equation.
27. Write a C program to calculate the following, where x is a fractional value. 1-x/2 +x^2/4-x^3/6.
28. Write a C program to read in two numbers, x and n, and then compute the sum of this geometric progression: 1+x+x^2+x^3+………….+x^n. For example: if n is 3 and x is 5, then the program computes 1+5+25+125.
29. Write a functions to compute mean, variance, Standard Deviation, sorting of n elements in single dimension array.
30. Write a C program that uses functions to perform the Transpose of a matrix with memory dynamically allocated for the new matrix as row and column counts may not be same.
31.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 find x^n
FILES
32. Write a C program to display
the contents of a file to standard output device.
33. Write a C program which copies one file to another,
replacing all lowercase characters with their uppercase equivalents.
34. Write a C program that does
the following:
It should first create a binary file and store 10 integers, where the file name and 10 values are given in the command line. (hint: convert the strings using atoi function) Now the program asks for an index and a value from the user and the value at that index should be changed to the new value in the file. (hint: use fseek function) The program should then read all 10 values and print them back.
It should first create a binary file and store 10 integers, where the file name and 10 values are given in the command line. (hint: convert the strings using atoi function) Now the program asks for an index and a value from the user and the value at that index should be changed to the new value in the file. (hint: use fseek function) The program should then read all 10 values and print them back.
35. Write a C program to merge two files into a third file
(i.e., the contents of the firs t file followed by those of the second are put
in the third file).
36. Write a C program that uses string functions To insert a sub-string in to
a given main string from a given position.
37. Write a C program that uses string functions To delete n Characters from a given position in
a given string.
38. Write a C program to determine if the given string is
a palindrome or not (Spelled same in both directions with or without a meaning
like madam, civic, noon, abcba, etc.)
the string S or – 1 if S doesn„t contain ch.
Comments
Post a Comment