C Programming Practical's (Basic Level Training Programs)

Download as pdf or txt
Download as pdf or txt
You are on page 1of 6

Programming for Problem Solving (Module-1) 2019

C PROGRAMMING PRACTICAL’S (BASIC LEVEL TRAINING PROGRAMS)

Day-1

1. Write a program to swap two numbers without using third variable.

2. Write a program to rotate value of three variables X, Y, Z using fourth variable such as assign value of Y

to X, Z to Y, X to Z.

3. Write a program to calculate the area of triangle using formula at=√s(s-a)(s-b)(s-c)

4. Basic salary of an employee is input through the keyboard. The DA is 25% of the basic salary while the

HRA is 15% of the basic salary. Provident Fund is deducted at the rate of 10% of the gross salary

(BS+DA+HRA).Program to calculate the Net Salary.

5. Write a program to find whether no is even or odd, positive or negative using bitwise operator.

6. Write a program to determine the roots of quadratic equation.

7. Write a program to find the largest of three numbers using nested if else.

8. Write a program to find the smallest of three numbers using conditional operator.

9. Write a program to find whether the year is leap year or not, without using logical operator.

10. Write a program to receive marks of physics, chemistry & maths from user & check its eligibility for

course if Marks of physics > 40 b) Marks of chemistry > 50 c) Marks of maths > 60

Total of physics & maths marks > 150 or Total of three subjects marks > 200

Day-2

11. Write the program to print the division or grade of student for given percentage.

12. Write the program to find the quadrant for the given coordinates using if else ladder.

13. Write a program to check whether the given character is upper case, lower case, numeric or symbol.

14. Write a program to draw the calculator using switch statement in c language.

15. Write a program to find the value of y for a particular value of n. The a, x, b, n are input by user

1
Programming for Problem Solving (Module-1) 2019
If n=1 y=ax%b if n=2 y=ax2+b2 if n=3 y=a-bx if n=4 y=a+x/b

16. Write a program to construct a Fibonacci series upto n terms.

17. Write a program to find sum of a Fibonacci series up to 100 terms.

18. Write a program to calculate the factorial for given number.

19. Write a program to generate sum of series 1!+2!+3!+--------------n!

20. Write a program to find the sum of following series 1-X1/1!+X2/2!- …………Xn/n!.

Day-3

21. Write C program to evaluate the sum of series -14+34-54+--------------------n4 terms.

22. Write a program to find the sum of digits for a given five digit number.

23. Write a program to reverse the digits of a four digit number.

24. Write a program to find whether the number is Armstrong number.

25. Write a program to find whether the number is palindrome or not.

26. Write program to find whether the number is prime or not.

27. Write a program to print the entire prime no between 1 and 300.

28. Write a program to print out all the Armstrong number between 100 and 500.

29. Write a function that return sum of all the odd digits of a given positive no entered through keyboard.

30. Write a program to print area of rectangle using function & return its value to main function.

Day-4

31. Write a program to calculate the factorial for given number using function.

32. Write a program to find sum of Fibonacci series using function.

33. Write a program to swap two number using call by value & call by reference.

34. Write factorial function & use the function to find the sum of series S=1!+2!+-----n!.

35. Write a function that returns the sum of elements of diagonal for given two matrixes.

2
Programming for Problem Solving (Module-1) 2019
36. Write a program to find the factorial of given number using recursion.

37. Write a program to find the sum of digits of a 5 digit number using recursion.

38. Write a program to construct a Fibonacci series upto n terms using recursion.

39. Write a program to calculate the GCD of given numbers using recursion.

40. Write a program to draw the following figure

* 321 * a

** 21 * * a b

*** 1 * * * a b c

41. Write a program to receive a five digit no and display as like 24689

2 4 6 8 9

4 6 8 9

6 8 9

8 9

Day-5

42. Write a program to search a specific number in list of array.

43. Write program to sort the list of n integers using bubble sorting technique.

44. Write a program to convert decimal number in to binary number.

45. Write a program to convert binary number in to decimal number.

46. Write a program to delete duplicate element in a list of 10 elements & display it on screen.

47. Write a program to merge two sorted array & no element is repeated during merging.

48. Write a program to find the largest number of 4X4 matrix & also calculate the average of all.

49. Write a program to evaluate the addition of diagonal elements of two square matrixes.

3
Programming for Problem Solving (Module-1) 2019
50. Write a program to find the transpose of a given matrix & check whether it is symmetric or not.

51. Write a program to print the multiplication of two N*N (Square) matrix.

Day-6

52. Write the implementation of the following string handling functions

a) strlen() b) strcpy() c) strcat() d) strcmp() e) strrev()

53. Write a program in C to check whether the given string is a palindrome or not.

54. Write program to sort the array of character (String) in alphabetical order like STRING in GINRST.

55. Write a program to remove all the blank space from the string & print it, also count the no of

characters.

56. Write a program to enter string from user & perform the following operations :

a) Count no of character b) Remove space in string c) Count no of words

57. Write a program to store the following string “zero”, “one” -------“five”. Print the no in words, given in

figure as 3205.

58. Write a program to create enum constant & display month in the year using enumerated data type.

59. Write the following C program using pointer

a) To sort the list of numbers through pointer b) To reverse the string through pointer.

Day-7

60. Declare the structure which contains the following members and write in C list of all students who

score more than 75 marks. Roll No, Name, Father Name, Age, City, Marks.

61. Create a structure to specify data on 100 students given below: Roll Number, Name, Department,

Course, Year of Joining

a) Write function to print names of all students joined in a particular year.

b) Write a function to print the data of a students whose roll no is given.

4
Programming for Problem Solving (Module-1) 2019
62. Write a program to compare two given dates. To store a date uses a structure that contains three

members namely day, month and year. If the dates are equal then display message equal otherwise

unequal.

63. Define a structure that can describe a hotel. It should have the member that includes the name,

address, grade, room charge and number of rooms. Write a function to print out hotel of given grade

in order of room charges.

64. Define a structure called cricket with player name, team name, batting average, for 50 players & 5

teams. Print team wise list contains names of player with their batting average.

65. Write a c program to copy & count the character content of one file says a.txt to another file b.txt.

66. Write a program to take 10 integers from file and write square of these integer in other file.

67. Write a program to read number from file and then write all ‘odd’ number to file ODD.txt & all even to

file EVEN.txt.

68. Write a program to print all the prime number, between 1 to 100 in file prime.txt.

Day-8

69. Write a program to find the largest no in two dimension array using static memory allocation.

70. Write a C program to find the largest no among 20 integers array using dynamic memory allocation.

71. Using Dynamic Memory Allocation, Write a C program to find the transpose of given matrix.

72. Write a program to find the factorial of given number using command line argument.

73. Write a program to find the sum of digits of a 5 digit number using command line argument.

74. Write a program to construct a Fibonacci series up to n terms using command line argument.

75. Write a program to find whether the number is Armstrong number using command line argument.

Assessment
MCQ
Programming Problems

5
Programming for Problem Solving (Module-1) 2019

You might also like