0% found this document useful (0 votes)
8 views

C Programming Assignments

Uploaded by

p03426503
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views

C Programming Assignments

Uploaded by

p03426503
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7

C PROGRAMMING ASSIGNMENTS:

1. WAP IN C THAT TAKE 2 NUMBER AND PERFORM THE


ADDITION,SUBTRACTION,MULTIPLICATION,DIVISION BETWEEN TWO NUMBERS.

2. WAP IN C THAT TAKE THE CELSIUS TEMPERATURE IN FAHRENHEIT


TEMPERATURE.

3. WAP IN C THAT CALCULATE THE AREA AND PERIMETER OF RECTANGLE.

4. WAP IN C THAT CALCULATE THE AREA AND PERIMETER OF CIRCLE.

5. WAP IN C THAT CALCULATE THE AREA AND PERIMETER OF SQUARE.

6. WAP IN C THAT CALCULATE THE AREA AND PERIMETER OF TRIANGLE.

7. WAP IN C THAT TAKE 2 NUMBER AS INPUT AND INTERCHANGE THEIR VALUES


EXAMPLE:

INPUT
a=4
b=5

Output
a=5
b=4

8. Any year is input through the keyboard. Write a program to determine whether
the year is a leap year or not.

9. Given three points (x1, y1), (x2, y2) and (x3, y3), write a program to check if all the
three points fall on one straight line.

10. A university has the following rules for a student to qualify for a degree with A
as the main subject and B as the subsidiary subject:

(a) He should get 55 percent or more in A and 45 percent or more in B.

(b) If he gets less than 55 percent in A he should get 55 percent or more in B.


However, he should get at least 45 percent in A.
(c) If he gets less than 45 percent in B and 65 percent or more in A he is
allowed to reappear in an examination in B to Qualify.

(d) In all other cases he is declared to have failed.

Write a program to receive marks in A and B and Output whether the student
has passed, failed or is allowed to reappear in B.

11. WAP in c that finds the sales price of a product.

Price Tag Discount

5000-9999 5%

10000-19999 10%

20000-39999 15%

40000-49999 20%

50000 above 25%

12. Wap in c that find the factorial of a number.


13. Wap in c to check a number is prime or not.
14. Wap in c to check a number is perfect or not.
15. Wap in c to check a number is palindrome or not.
[ example:
121,1221
If the reverse of a number is equal to the number itself then it is called
palindrome number . ]

16. Wap in c check a number is an Armstrong number or not.


[ example:
153,371,370
153=1^3+5^3+3^3
An Armstrong number is a number such that the sum of its digits raised to the third
power is equal to the number itself ]
17. Wap in c check if a number is Krishnamurti number or not.
[ example:
145
145=1! + 4! + 5!
An Krishnamurti number is a number such that the sum of its digits factorial is equal
to the number itself ]
18. Wap in c to find the sum of prime numbers between 10 to 50,
19. Wap in c that will print the non-prime number between 20 to 50.
20. Wap in c that will print the fibonacci series upto N number.
[ Example:
Fibonacci series: 0,1,1,2,3,5,8,13,.....
Next number of the series is calculated by the sum of the previous two terms.
0+1=1,1+1=2,1+2=3,2+3=5,... and so on.
If we take input N as 5 then the series will print 5 numbers of the series starting
from 0 ,such that 0,1,1,2,3
If we take input N as 8 then the series will print 8 numbers of the series starting
from 0 ,such that 0,1,1,2,3,5,8,13
21. Wap in c that find the sum of odd numbers and even numbers separately between
the range 30 to 65.
22. Calculate the series:
1) 3+6+9+12+15+......+30
2) 1-2+3-4+5-6+7-....... (-1)(n+1) .N
3) ½+¼+⅙+....+1/2n
4) ½!+ ⅔!+¾!+⅘!+.........+n/(n+1)!
5) 1-x2/2!+x4/4!-x6/6!+….. [ cos series ]
6) x-x3/3!+x5/5!-x7/7!+….. [ sin series ]

23. Find the twin prime numbers between a specific range.


24. Find the GCD and LCM between 2 numbers.
25. Find the GCD and LCM between n numbers.
26.
27. Wap in c that input n numbers in an array find the sum and count of even and odd
numbers separately.\

28. Wap in c that input n numbers in an array and reverse the elements of the array.
Example:
Input : 5 6 9 3 2
Output: 2 3 9 6 5

29. Wap in c that input n numbers in an array find the sum of prime numbers among n
numbers in the given array.

30. Wap in c that input n numbers in an array find the maximum and minimum number
.
31. Wap in c that input n numbers in an array find the 2nd maximum and 2nd
minimum number .

32. Wap in c that input n numbers in an array and a key value which is to be searched
and print the location of the key value using linear search.

33. Wap in c that input n numbers in an array and a key value which is to be searched
and print the location of the key value using binary search.

34. Wap in c that input n numbers in an array and a key value and perform binary
search and linear search using function and switch case.

35. Wap in c that input n numbers in an array and print the array elements in
ascending order and descending order using bubble sort.
36. Wap in c that input n numbers in an array and print the array elements in
ascending order and descending order using selection sort.
37. Wap in c that input n numbers in an array and print the array elements in
ascending order and descending order using insertion sort.

38. Wap in c that input n numbers in an array and remove the duplicate elements
from the array.
Example:
Input:
Array : 3 6 7 8 6 2 3
Output:
36782

39. Wap in c that input n numbers in an array and a value and a position, insert the
the input value in the given position.
Example:
Array : 3 6 7 8 9 2
Value: 4
Position: 3
Outp[ut: 3 6 7 4 8 9 2

40. Wap in c that input n numbers in an array and find the occurrence of each number
in the given array.
Input:
Array : 3 6 7 8 6 2 3 3 2
Output:
3 occur 3 times
6 occur 2 times
7 occur 1 times
8 occur 1 times
2 occur 2 times

41. Wap in c that input n,m numbers in two array say A[ ] ,B[ ] respectively then merge
the elements of two array A[] and B[] one after another( that means all the
elements of the A array then all the elements of the B array) into new array called
C[], and print the new array C[].
42. Wap in c that input n,m numbers in two array say A[ ] ,B[ ] respectively in a sorted
order then merge two sorted array A and B into another sorted array called C[ ],so
that all the elements of the C[ ] array are in a sorted order ,and print the new array
C[].

43. Wap in c that input n numbers in an array then split the elements of the array into
two different arrays EVEN[ ] and ODD[ ] based on even and odd numbers
respectively.

44. Wap in c that input n numbers in an array then split the elements of the array into
two different arrays EVEN[ ] and ODD[ ] based on even and odd position
respectively.

45. Wap in c that performs the addition,subtraction,multiplication,division b/w two


matrices and store it into other matrices using switch case.
46. Wap in c that stores the matrix elements into an 1d array using row and column
major order.
47. Wap in c that finds the transpose of a matrix.
48. Wap in c that checks a matrix whether it is a magic square or not.
49. Wap in c that performs the spiral print of a matrix.
50. Wap in c that accepts a string count the number of vowels,consonant,space,
word and total characters of the string.
51. Wap in c that implements all the invild string functions(strlen,strcat,strcmp,strcpy)
by its user defined version using switch case.
52. Wap in c that input a string and convert all lowercase characters to its uppercase
characters and vice versa.
53. Wap that accepts a string as password and prints the password as “strong
password” if the password contains a minimum 6 letters and contains 1 capital
letter ,1 lower letter,1 number ,1 special symbol at least otherwise it will print
“weak password”.
54. Wap in c that accepts a name as string( like, RaHul kuMar Roy) and print R.K.ROY
as an output.
55. Wap in c that accepts a string and find the frequency of a word supplied by the
user then replace the word into the string with the replacing word which is
supplied by the user.
Example:

Input : he is a good boy and good in c.

Searching string : good

Replacing string : bad

Output :

Occurrence of string good is =2

Replacing string : he is a bad boy and bad in c.

56. Wap in c the remove the multiple space with a single space in a string.

Example:

Input : he is a good boy.

Output : he is a good boy.

57. Wap in c that removes the consecutive word.

Example:

Input : He is is a good boy boy.

Output : he is a good boy.

58. Wap in C that adds,subtract,multiply,and divide two complex number stores into
another complex number using switch case.
59. Wap in C that defines a data type student which contains 3 parts
name,roll,marks,enter the record of N students and find the record of the student
who gets maximum and minimum marks.
60. Wap in C that defines a data type student which contains 3 parts
name,roll,marks,enter the record of N students and display the record of the
student in ascending order based on the marks.
61. Wap in C that defines a data type Book which contains 3 parts subject,author
name,price enter the record of N books and find the record of the book which has
maximum and minimum price.
62. Wap in C that defines a data type Book which contains 3 parts subject,author
name,price enter the record of N books and display the record of the book in
ascending order.
63. Wap in c that will read content from a file and write content into a file.
64. Wap in c that will copy the content of one file into another file.
65. Wap in c that reads content from a file which contains multiple word line by line
and find the palindrome word and store it in another file.
66. Wap in c that will perform the encryption on the reading content from a file and
store it another file.

Example:

input.txt

adbfxy

Output.txt

cfdhzy

67. Wap in c that copy the structure content from a file and write it into another file.
68. Wap in c that performs some of the string related programmes mentioned above
using a file that I mentioned in the class.
69. Wap in c that performs command line argument related programmes that I will
mention in the class.
70.
71.
72.

You might also like