You are on page 1of 19

Assignment

UNIT-4
Programming
1. Write a program to calculate simple interest.
Ans

2. Write a program to swap the value of two


variables.
Ans.

3. Write a program to swap the value of two


variables without taking any third variable.
Ans.
4. Write a program to check the leap year.

Ans.

5. Write a program to check given number is


negative of positive.
6.Write a program to check given number is odd or

.
even Ans
7. Write a program to check greatest number from
given three number.
Ans.

8. Write a program to print month name of a given


month number.
Ans.
9.Write a program to check given character is
vowel, consonant, digits or special character.
Ans.
10. Write a program to print the table of a given
number.
Ans.

Write a program to print factorial of a given


number.
Ans.

12. Write a program to print the following format:-


a. 1
12
123
1234.
.b. 1234
123
12
1.
Ans. (a)
(B)

13. a. b. *
****
**
***
***
**
****
*
(b).

(A).
14. (a) 4 (b) 4321
34 432
234 43
1234 4
(a)

(B)

15. (A) 4 (B) *


43 ***
432 *****
4321 *******
Ans. (A)

(b)

16. (A) 1 (b) A


121 ABA
12321 ABCBA
1234321 ABCDCBA
(a) (b)
17.Write a program to check given number is prime or
not.
Ans.
18.Write a program to print all prime numbers from 1
to 500.
Ans.

19.Write a program to print Fibonacci series.


Ans.
20.Write a program to calculate the compound
interest.
Ans.

21.Write a program to print the sum of each digits of a


given number.
Ans.
22.Write a program to reverse the digits of a given
number.
Ans.

23.Write a program to check given number is


palindrome or not.
Ans.
24.Write a program to print the sum of first and last
digits of a given number.
Ans.

25.Write a program to print the result of ab for the


given value of variable a and b.
Ans.

You might also like