Exercise - 1
- Program to swap two numbers without using temporary variable and arithmetic operators.
- Program to check whether the number is even or odd without using arithmetic operators.
- Program to double the given number without using '*' operator.
Exercise - 2
- Program to find minimum number of denominations for given amount.
- 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%
- Given an integer, n, perform the following conditional actions:
- If n is odd, print Weird
- If n is even and in the inclusive range of 2 to 5, print Not Weird
- If n is even and in the inclusive range of 6 to 20, print Weird
- If n is even and greater than 20, print Not Weird
Exercise - 3
- 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) - Program to find sum of digits of a given number until sum becomes single digit.
Exercise - 4
- Program to print pattern as shown in below.
Sample Input
5
Sample Output
1 0 0 0 1
0 1 0 1 0
0 0 1 0 0
0 1 0 1 0
1 0 0 0 1
- Program to print pattern as shown in sample output.
Sample Input
5
Sample Output
A
ABA
ABCBA
ABCDCBA
ABCDEDCBA
- Program that displays butterfly pattern as shown sample given below.
Sample Input
4
Sample Output
* *
** **
*** ***
********
********
*** ***
** **
* *
Exercise - 5
- Program to count the frequency of each element of an array.
- Program to find duplicate element in k-distance. If found print "YES" otherwise "NO".
- Program for left rotate of array elements for k-times.
Exercise - 6
- Program to swap cases in the given String.
- Program to check whether given expression contains valid parenthesis or not.
- Program to implement Caesar Cipher.
Note: Caesar Cipher is an encryption technique in cryptography. In this technique, we are given a text which we have to encrypt by shifting the characters by some fixed number of positions.