Cs Question by Rajendra
Cs Question by Rajendra
Cs Question by Rajendra
3. Write a C program to read and print your name, date of birth. and mobile number.
5. Write a C program to enter two numbers and perform all arithmetic operations.
6. Write a C program to enter length and breadth of a rectangle and find its area and
perimeter.
7. Write a C program to enter radius of a circle and find its diameter, circumference and
area.
8. Write a C program to enter length in centimeter and convert it into meter and
kilometer.
10. Write a C program to enter any number and calculate its square root.
11. Write a C program to enter two angles of a triangle and find the third angle.
12. Write a C program to enter base and height of a triangle and find its area. Write a C
program to calculate area of an equilateral triangle.
13. Write a C program to enter marks of five subjects and calculate total, average and
percentage.
######
#
#
#####
#
#
#
16. Write a C program to print a big 'C' using hash (#) as follows.
######
## ##
#
#
#
#
#
## ##
######
17. Write a C program to compute the perimeter and area of a rectangle with a height of
7 inches. and width of 5 inches.
18. Write a C program to compute the perimeter and area of a circle with a radius of 6
inches.
19. Write a C program to find the area of a CUBE, CONE, CYLINDER and
TRAPEZIUM.
20. Write a C program to display the values stored in multiple variables belonging to
different data types.
21. Write a C program to declare and display the size of 'int', 'float', 'char', 'short', 'long',
'double', 'long double' variables.
22. Write a C program to convert specified days into years, weeks and days. Note: Ignore
leap year.
23. Write a C program that accepts two item’s weight (floating points' values) and
number of items (floating points' values) and calculate the average value of the items.
24. Write a C program that accepts an employee's ID, total worked hours of a month and
the amount he received per hour. Print the employee's ID and salary (with two
decimal places) of a particular month.
25. Write a C program that accepts three integers and find the maximum of three.
26. Write a C program to calculate the distance between the two points.
27. Write a C program to read an amount (integer value) and break the amount into
smallest possible number of bank notes.
28. Write a C program that read 5 numbers and sum of all odd values between them
without using loops and arrays.
29. Write a C program that reads three floating values and check if it is possible to make
a triangle with them. Also calculate the perimeter of the triangle if the said values
are valid.
30. Write a C program that reads an integer between 1 and 12 and print the month of
the year in English using enumerations.
31. Write a C program that read 5 numbers and counts the number of positive numbers
and negative numbers.
32. Write a C program to check a given integer is positive even, negative even, positive
odd or negative odd. Print even if the number is 0.
33. Write a C program that accepts some integers from the user and find the highest
value and its position without using loops and arrays.
34. Write a C program to check if two numbers in a pair is in ascending order or
descending order.
35. Write a C program to read a password until it is correct. For wrong password print
"Incorrect password" and for correct password print "Correct password" and quit the
program. The correct password is 1234.
36. Write a C program that reads an integer and find all its divisor.
37. Write a C program to read an array of length 5 and print the position and value of
the array elements of value less than 5.
38. Write a C program to read an array of length 6, change the first element by the square
of last element, the second element by the cube of fifth element and the third element
by the square root of the fourth element. Print the elements of the modified array.
39. Write a C program that accepts a distance in centimeters and prints the
corresponding value in inches.
40. Write a C program that swaps two numbers without using third variable.
41. Write a C program to shift given number by two bits to the left.
42. Write a C program to check Least Significant Bit (LSB) of a number is set or not
using bitwise operators.
43. Write a C program to get nth bit of a number using bitwise operators.
44. Write a C program to set nth bit of a number using bitwise operators.
45. Write a C program to toggle nth bit of a number using bitwise operators.
46. Write a C program to count trailing zeros in a binary number using bitwise operators.
47. Write a C program to count leading zeros in a binary number using bitwise operators.
48. Write a C program to count total zeros and ones in a binary number using bitwise
operators.
49. Write a C program that accepts 4 real (float) numbers from the keyboard and display
the difference of the maximum and minimum values of these four numbers.
50. Write a C program to create enumerated data type for 7 days and display their values
in integer constants.
51. Write a C program to find if a person is an adult using ternary operator (conditional
operator).
52. Write a C program to find if a number is positive, negative or zero using ternary
operator (conditional operator).
53. Write a C program that accepts a positive integer less than 500 and prints out the
sum of the digits of this number.
54. Write a C program that accepts integers from the user until a zero or a negative
number, display the number of positive values, the minimum value, the maximum
value and the average of all numbers.
55. Write a C programming that reads in two integers and check whether the first integer
is a multiple of the second integer.
56. Write a C programming to display the integer equivalents of letters (a-z, A-Z).
58. Write a C programming that reads the side (side sizes between 1 and 10) of a square
and prints square using hash (#) character.
59. Write a C programming that reads the side (side sizes between 1 and 10) of a square
and prints a hollow square using hash (#) character (i.e print ‘#’ in only the borders).
60. Write a C programming which reads an integer (7 digits or fewer) and count number
of 3s in the given number.
61. Write a C programming to print a table of all the Roman numeral equivalents of the
decimal numbers in the range 1 to 50.
64. Write a C program that reads an integer between 1 and 12 and print the month of
the year in English using switch statement.
65. Write a C program to accept two integers and check whether they are equal or not.
66. Write a C program to read the age of a candidate and determine whether it is eligible
for casting his/her own vote.
72. Write a C program to check whether a number is even or odd using conditional
operator.
73. Write a C program to check whether year is leap year or not using conditional
operator.
76. Write a C program using if- else ladder to enter two number and check they are equal,
grater or less to each other.
77. Write a C program using if- else ladder to enter a number and check divisible by both
5 and 8, divisible by 8, divisible by 5 or divisible by none.
78. Write a C program to input any character and check whether it is alphabet, digit or
special character using if-else ladder.
79. Write a C program to input week number and print week day using if-else ladder.
80. Write a C program to input month number and print number of days in that month
using if-else ladder.
81. Write a C program to count total number of notes in given amount using if-else
ladder.
82. Write a C program to input all sides of a triangle and check whether triangle is valid
or not using nested-if statement.
83. Write a C program using if-else ladder to input basic salary of an employee and
calculate its Gross salary according to following:
84. Write a C program using if-else ladder to input electricity unit charges and calculate
total electricity bill according to the given condition:
86. Write a C program to check whether a triangle can be formed by the given value for
the angles.
88. Write a program in C to read any digit, display it in the word using switch case.
89. Write a program in C to accept subject marks and declare the equivalent grade using
switch statement
90. Write a C program to print day of week name using switch case.
91. Write a C program print total number of days in a month using switch case.
92. Write a C program to check whether an alphabet is vowel or consonant using switch
case.
93. Write a C program to find maximum between two numbers using switch case.
94. Write a C program to check whether a number is even or odd using switch case.
95. Write a C program to check whether a number is positive, negative or zero using
switch case.
98. Write a program in C which is a Menu-Driven Program to compute the area of the
various geometrical shape using switch case.
2. Questions on Looping Structures
1. Write a program in C to display the first ‘n’ natural numbers using both ‘for’ and
‘while’ loops.
3. Write a program in C to read 10 numbers from keyboard and find their sum and
average.
6. Write a program in C to display the n terms of odd natural number and their sum.
7. Write a C program that prints all even numbers between 1 and 50 (inclusive).
10. Write a program in C to find the number and sum of all integer between 100 and
200 which are divisible by 9.
11. Write a program in C to display the sum of the series [ 9 + 99 + 999 + 9999 ...n].
12. Write a C program to print all natural numbers from 1 to n. - using while loop.
13. Write a C program to print all natural numbers in reverse (from n to 1) using while
loop.
14. Write a C program to print all alphabets from a to z. - using do-while loop.
15. Write a C program to print all even numbers between 1 to 100. – using do-while
loop.
17. Write a C program to find sum of first and last digit of a number.
20. Write a C program to print all ASCII character with their values.
24. Write a c program to check whether a given number is a perfect number or not.
25. Write a c program to display the perfect numbers within a given range.
26. Write a c program to display the strong numbers within a given range.
29. Write a C program to find the Armstrong number between two range of numbers.
32. Write a program in C to find the sum of the series [ x - x^3 + x^5 + ......].
33. Write a program in C to display the n terms of harmonic series and their sum as
follows.
1 + 1/2 + 1/3 + 1/4 + 1/5 ... 1/n terms
34. Write a program in C to display the n terms of square natural numbers (1 4 9 16 ...
n Terms) and their sum.
37. Write a program in C to find LCM of any two numbers using HCF.
38. Write a C program to find GCD Using ‘for’ loop and ’if’ Statement.
39. Write a C program to find GCD for both positive and negative numbers.
41. Write a C program to calculate the sum of all number not divisible by 17 between 1
to 500.
42. Write a C program to find all the numbers which upon dividing it by 7 gives the
remainder equal to 2 or 3 between 1 to 500.
43. Write a C program to print a number, it’s square and cube in a line starting from 1
to 10.
44. Write a program in C to Check Whether a Number can be Express as Sum of Two
Prime Numbers.
45. Write a C program to calculate the average marks of mathematics of ‘n’ students.
Input 0 or negative value to terminate the input process.
46. Write a C program to calculate S = 1 + 1/2 + 1/3 + … + 1/50.
49. Write a C Program to convert Decimal to Binary and vice versa with and without
using an array.
50. Write a C Program to convert Decimal to Octal and vice versa with and without
using an array.
51. Write a program in C to convert a decimal number to hexadecimal and vice versa.
52. Write a C program to convert Octal to Hexadecimal number system and vice
versa.
53. Write a C program to convert Hexadecimal to Binary number system and vice
versa.
54. Write a C program to convert Hexadecimal to Octal number system and vice
versa.
58. Write a C program to print inverted half pyramid using numbers as follows.
12345
1234
123
12
1
1
23
456
7 8 9 10
*
***
*****
*******
*********
*******
*****
***
*
63. Write a C Program to display the pattern like pyramid using the alphabet.
A
ABA
ABCBA
ABCDCBA
3. Questions on 1-D & 2-D Arrays
4. Write a program in C to copy the elements of one array into another array.
6. Write a C program to count total number of even and odd elements in an array
7. Write a C program to read and print the elements of an array of length 7, before
print replace every negative number, zero with 100.
11. Write a program in C to merge two arrays of same size sorted in descending order.
13. Write a C Program to Find the Number of Non Repeated Elements in an array.
15. Write a C Program to Segregate 0s on Left Side & 1s on right side of the Array.
16. Write a C Program to Find the two Elements such that their Sum is Closest to
Zero.
17. Write a C Program to Find if a given Integer X appears more than N/2 times in
a Sorted Array of N Integers.
18. Write a program in C to find the maximum and minimum element in an array.
19. Write a C Program to Find 2 Elements in the Array such that Difference between
them is Largest.
20. Write a program in C to separate odd and even integers in separate arrays.
21. Write a program in C to calculates the standard deviation of 10 data using arrays.
22. Write a C program to left rotate /right rotate an array by ‘n’ number of places.
23. Write a C Program to Check Array bounds while Inputting Elements into the
array.
25. Write a C Program to Find the Median of the Elements after Merging these 2
Sorted Arrays with Same Size.
27. Write a C program to sort even and odd elements of array separately.
28. Write a program in C to insert New value in the array (sorted list).
29. Write a program in C to insert New value in the array (unsorted list) at a specific
place.
31. Write a program in C to find the second largest/ second smallest element in an
array.
34. Write a program in C to find largest number possible from the set of given
numbers.
35. Write a program in C to find four array elements whose sum is equal to given
number.
36. Write a program in C to count all distinct pairs for a specific difference.
37. Write a program in C to print all possible combinations of ‘n’ elements in a given
array as follows.
The given array is:
1 5 4 6 8 The combination from by the number of elements are: 3
The combinations are:
1 5 4 6
1 5 4 8
1 5 6 8
1 4 6 8
5468
38. Write a program in C to return true if an array can be splitted in such a position
that, the sum of left side of the splitting is equal to the sum of the right side.
39. Write a program in C to return the number of clumps (a series of 2 or more
adjacent elements of the same value) in a given array.
42. Write a C program for Given an array A[] and a number x, check for pair in A[]
with sum as x.
43. Write a C program for Find the Numbers Occurring Odd Number of Times.
45. Write a C program for Maximum difference between two elements such that
larger element appears after the smaller number.
51. Write a C program for Find four elements that sum to a given value in an array.
59. Write a C program to Split an array from specified position and add first part to
the end.
60. Write a C Program to accept Sorted array and do Search using Binary Search.
61. Write a program in C to read a 2D array of size 3x3 and print the matrix.
63. Write a program in C to search an element in a row wise and column wise sorted
matrix.
70. Write a C Program to Sort Rows of the Matrix in Ascending & Columns in
Descending Order.
71. Write a C Program to Find the Frequency of Odd & Even Numbers in the given
Matrix .
72. Write a C Program to Accept a Matrix of Order MxN & Interchange the
Diagonals .
76. Write a program in C to find the sum of upper triangular and lower triangular
elements of a matrix.
81. Write a program in C to print only the unique rows from a given binary matrix
having only 1s and 0s.
82. Write a program in C to find maximum size square sub-matrix.
4. Questions on Strings
1. Write a program in C to find the square of any number using the function.
2. Write a C program to find cube of any number using function.
3. Write a C program to find diameter, circumference and area of circle using
functions.
4. Write a C program to find maximum and minimum between two numbers using
functions.
5. Write a program in C to swap two numbers using function.
6. Write a program in C to check a given number is even or odd using the function.
7. Write a program in C to find the factorial of a number.
8. Write a program in C to find the sum of the series 1!/1+2!/2+3!/3+4!/4+5!/5 using
the function.
9. Write a program in C to convert decimal number to binary number using the
function.
10. Write a program in C to check whether a number is a prime number or not using
the function.
11. Write a C program to find all prime numbers between given interval using
functions.
12. Write a program in C to check armstrong and perfect numbers using the function.
13. Write a program in C to print all perfect numbers in given range using the
function.
14. Write a program in C to get the largest element of an array using the function.
15. Write a program in C to check whether two given strings are an anagram using
the function.
* Implement all the previous arrays and strings topic questions using functions.
6. Questions on Recursion