I. Operators
- Program to find sum of two numbers without using '+' operator.
- Program to find sum of two numbers without using arithmetic operator.
- Program to find largest number among two without using relational operators.
- Program to find second largest number among three numbers without using relation operators.
- Program to check whether the number is even or odd without using '%' operator.
- Program to swap two numbers without using temporary variable.
- Program to swap two numbers without using temporary variable and arithmetic operators.
- Program to check whether the number is even or odd using bit-wise operator.
- Program to count number of bits set.
- Program to double the given number without using '*' operator.
II. if-else
- Program to find largest number between two numbers.
- Program to find largest number between three numbers.
- Program to find second largest number between three numbers.
- Program to check whether the given number is positive, negative or zero.
- Program to print wishes according to the time given in hours.
- Program to check whether given alphabet is vowel or consonant.
- Program to check whether given character is alphabet, digit or symbol.
- Pogram to check given year is leap year or not.
- Program to input marks of five subjects Physics, Chemistry, Biology, Mathematics and Computer. Calculate percentage and grade according to following:
Percentage >= 90% : Grade A
Percentage >= 80% : Grade B
Percentage >= 70% : Grade C
Percentage >= 60% : Grade D
Percentage >= 40% : Grade E
Percentage < 40% : Grade F - Program to input basic salary of an employee and calculate its Gross salary according to following:
Basic Salary <= 10000 : HRA = 20%, DA = 80%
Basic Salary <= 20000 : HRA = 25%, DA = 90%
Basic Salary > 20000 : HRA = 30%, DA = 95% - Program to find minimum number of denominations for given amount.
III. Switch
- Program to read a single digit number and print in words.
- Program to display number of days in a given month.
- Program to perform simple calculator operation.
- Program to check number is even or odd using switch.
- Program to find largest number between two numbers using switch
IV. Loops
- Program to print 'Hello' 5 times.
- Program to print natural numbers from 1 to N.
- Program to print natural numbers from 1 to N without using looping statements.
- Program to find sum of N natural numbers without using arrays.
- Program to display multiplication table of a given number.
- Program to count number of digits of a given number.
- Program to find sum of digits of a given number.
- Program to find reverse of a given number.
- Program to check whether given number is palindrome or not.
- Program to find factorial of given number.
- Program to check whether a number is prime or not.
- Program to print Fibonnaci series upto n-terms
- Program to compute and display the sum of the following series up to n-terms:
X – X/2 + X/3 – X/4 +… - Program to compute and display the sum of the following series up to n-terms:
(1*2)/(1+2) + (1*2*3)/(1+2+3) + … + (1*2*3*…*n)/(1+2+3+…+n)
V. Arrays
- Program that calculate the fractions of its elements that are positive, negative and zeros.
Sample Input:
8
-3 -2 -1 0 0 1 2 3
Sample Output:
0.375
0.25
0.375
Explanation:
Number of positive elements / total elements = 3/8 = 0.375
Number of zero elements / total elements = 2/8 = 0.25
Number of negative elements / total elements = 3/8 = 0.375
- Program to insert an element at given position in array.
Sample Input:
5
10 20 30 40 50
2
25
Sample Output:
10 20 25 30 40 50
Explanation:
n = 5
arr[] = {10,20,30,40,50}
pos = 2
newelement = 25
New Array after insertion is {10,20,25,30,40,50}
- Program to delete an element from an array at specified position.
Sample Input:
5
10 20 30 40 50
2
Sample Output:
10 20 40 50
Explanation:
n = 5
arr[] = {10,20,30,40,50}
Position to be delete 2
New Array after element delete {10,20,40,50}
- Program to reverse of array elements.
Sample Input:
5
10 20 30 40 50
Sample Output:
50 40 30 20 10
- Program to remove duplicates in array.
Sample Input:
6
1 2 3 2 4 2
Sample Output:
1 2 3 4
- Program to count the frequency of each element of an array.
Sample Input:
6
1 2 3 2 4 2
Sample Output:
1 1
2 3
3 1
4 1
- Program to sort the elements in array.
Sample Input:
5
3 4 2 5 1
Sample Output:
1 2 3 4 5
Explanation:
Arrange the array elements in ascending order.
- Program to find second smallest and second largest numbers from array.
Sample Input:
8
4 6 1 5 2 7 3 8
Sample Output:
2 7
- Program for left rotate of array.
Sample Input:
6
1 2 3 4 5 6
2
Sample Output:
3 4 5 6 1 2
Explanation:
n = 6
arr[] = {1,2,3,4,5,6}
After first left rotation, arr[] becomes {2,3,4,5,6,1} and after the second rotation, arr[] becomes {3,4,5,6,1,2}
- Program to find duplicate element in k-distance. If found print "YES" otherwise "NO".
Sample Input1:
8
1 2 3 4 1 2 3 4
3
Sample Output1:
NO
Explanation:
Each element in the given array arr[] appears twice and the distance between every element and its duplicate is 4.
Sample Input2:
6
1 2 3 2 4 5
3
Sample Output2:
YES
Explanation:
2 is present at index 1 and 3.
VI. Strings
- Program to count the number alphabets, digits and symbols in a String.
Sample Input: 8+8+8 is daily time management strategy
Sample Output: 29 3 7
Explanation: In the given String, Number of alphabets are 29, digits are 3 and symbols are 7.
- Program to find the frequency of characters in a string(case insensitivity).
Sample Input:
helloHowarEyou?
Sample Output:
h - 2
e - 2
l - 2
o - 3
w - 1
a - 1
r - 1
y - 1
u - 1
? - 1
- Program to swap cases in the given String.
Sample Input: Hello Govardhan1206
Sample Output: hELLO gOVARDHAN1206
Explanation: In the given String, if a character is in uppercase convert it into lowercase and vice-versa.
- Program to remove special characters from string.
Sample Input:
Training programs @ 4 placements
Sample Output:
Trainingprogramsplacements
Explanation: From the given string remove spaces, @ and 4 because their are not alphbets.
- Program to find the length of the longest word in a string.
Sample Input: Hello Govardhan How are you?
Sample Output: 9
Explanation: In the given String, substring Govardhan is longest string its length is 9.
- Program to find duplicate words in a string.
Sample Input:
where there is a will there is a way
Sample Output:
there
is
a
Explanation: Duplicate words in the specified string: there, is and a
- Program to find number of words having non-repeating characters.
Sample Input:
where there is a will there is a way
Sample Output:
5
- Program to reverse of individual words in the given string.
Sample Input:
Hello developers how are you
Sample Output:
olleH srepoleved woh era uoy
- Program to find highest frequency character in the given string.
Sample Input:
hello developer how are you?
Sample Output:
e 5
- Program to replace a substring with another string in the given string.
Sample Input:
hello world how are you
world
developer
Sample Output:
hello developer how are you
VII. 2-D Arrays
- Program to find sum of two matrices.
- Program to find multiplication of two matrices.
- Program to perform transpose of a given matrix.
- Program to print the given matrix in spiral form.
- Program to read N name from user and them in alphabetical order.
VIII. Pointers
- Program to create a pointer that can store address of any datatype.
- Program that implements arrays using pointer.
- Program to return multiple values from function.
IX. Functions and Structures
- Program to swap two numbers using call by reference.
- Program to pass array as function arguments.
- Program to implement function pointers.
- Program to store student details like rollno, fullname and address using structure.
- Program to create a node contains data field and address field using self-referential structure.