0% found this document useful (0 votes)
63 views6 pages

PLT Exercises: Programming Logic and Techniques

The document contains 38 programming problems covering topics like simple and compound interest calculations, number patterns, arrays, matrices, searching, sorting, strings, and more. The problems range from basic to more complex and cover fundamental programming concepts.

Uploaded by

rajalaxman
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
63 views6 pages

PLT Exercises: Programming Logic and Techniques

The document contains 38 programming problems covering topics like simple and compound interest calculations, number patterns, arrays, matrices, searching, sorting, strings, and more. The problems range from basic to more complex and cover fundamental programming concepts.

Uploaded by

rajalaxman
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

PLT Exercises

1. Write a program to accept principle, rate of interest and time. Calculate simple interest and
display the same

2. Write a program to accept two numbers. Display the two numbers. Swap the two numbers
and display them again.

3. Write a program to accept a number and display whether it is an even or odd number

4. Write a program to accept a double value. Separate the whole value from the fractional
value and store them in two variables. Display the same.

5. Write a program to accept a student’s name and scores in three subject. Display the
1st, 2nd average and total. Display whether the student has secured 1st , 2nd , pass class or
has failed.
1st class is for a score of 60 and above,
2nd class is for a score of 50 and above, while pass class is for a score of 35 and above. If the
score is less than 35, then the student fails.

6. Write a program to find the largest and second largest of 3 numbers

7. Write a program to accept name, empId, basic, special allowances, percentage of bonus and
monthly tax saving investments. The gross monthly salary is basic + special allowances.
Compute the annual salary. The gross annual salary also includes the bonus. Compute the
annual net salary, by deducting taxes as suggested.
a. Income upto 2.5 lakhs – exempted
b. Income from 2.5 lakhs to 5 lakhs – 5%
c. Income from 5 lakhs to 10 lakhs – 20%
d. Income from 10 lakhs onwards – 30%

However, if there is any tax saving investment, then there is further exemption of upto 1.5
lakhs annually. This would mean that by having tax saving investments of about 1.5 lakhs, an
income of 4 lakhs is non-taxable. Display the annual gross, annual net and tax payable.

pg. 1 Programming Logic and Techniques


8. A vendor offers software services to a client. Each resource is billed at some dollar rate per
hour. The total cost of the project for the client is therefore, the total number of hours
contributed by all the vendor resources * the dollar rate / hour. There are however some
variants.
a. The vendor might have purchased hardware/infrastructure or software licenses
needed for the project.
b. The vendor might have utilized external consultants for the project.
c. The client looks at the vendor as a one stop solution and hence external resources
employed by the vendor need to be paid by the vendor.
d. It might however be possible that the vendor’s hardware and software purchases
are borne by the client. In this case, the client pays the vendor 30% of the
hardware/infrastructure costs. In case of software licenses, the client pays the
vendor 50% of the cost, if they are commonly available and used, or 100% if the
software is infrequently used or is proprietary client technology.
e. The external consultants employed by the vendor will come at a dollar rate per
hour.
f. Accept the suitable inputs and display the profits / loss realized by the vendor.

9. Write a program to find the sum of all odd numbers from 1 to N. Accept N. Display the sum.

10. Write a program to find the reverse of a number. Store the reverse value in a different
variable. Display the reverse.

11. Write a program to display a number in words.

12. Write as many programs to generate the following series. In all the following cases, accept
N:
a. 4, 16, 36, 64, … N
b. 1, 2, 3, 4, 5, 6, … N
c. 1, 4, 27, 256, 3125, … N
d. 1, 4, 7, 12, 23, 42, 77, … N
e. 1, 4, 9, 25, 36, 49, 81, 100, … N
f. 1, 5, 13, 29, 49, 77, … N

13. Write a program to find the sum of all the prime numbers in the range n to m. Display each
prime number and the final sum.

14. Write a program to find the factorial of a given number. 0! is always 1. Factorial of a
negative number is not possible.

15. Write a program to find whether a given number is a finonacci number or not.

pg. 2 Programming Logic and Techniques


16. Write a program to accept a decimal number. Display it in the binary form.

17. Write a program to accept a binary number and display it in the decimal form.

18. Write a program to display the 1st , 2nd , and 4th multiple of 7 which gives the remainder 1
when divided by 2,3,4,5 and 6

19. Write a program to do the following:


a. Input: 270176
b. Output: Two Seven Zero One Seven Six

20. Write a program that takes amount and displays them in words
a. Input: 1234
b. Output: One thousand two hundred and thirty four only

21. Accept the item code, description, qty and price of an item. Compute the total for the item.
a. Accept the user’s choice. If the choice is ‘y’ then accept the next set of inputs for a
new item and compute the total. In this manner, compute the grand total for all the
items purchased by the customer.
b. If the grand total is more than Rs. 10,000/‐ then, the customer is allowed a discount
of 10%.
c. If the grand total is less than Rs. 1,000/‐ and the customer chooses to pay by card,
then a surcharge of 2.5% is levied on the grand total.
d. Display the grand total for the customer in number form and in words.

22. Write the pseudo codes to generate the following series. In all the following cases, accept N:
a. 1, 2, 6, 15, 31, 56 … N
b. 1, 1, 2, 3, 5, 8, 13, … N
c. 1, 2, 4, 6, 7,10, 10,14… N
d. 1, 5, 8, 14, 27, 49, … N

23. Write a program to find X ^ N (x to the power of n) without using in-built functions. Accept X
and n. Display the result.

24. Write a program to check if the string is a palindrome

25. Write a program to store N elements in an array of integer. Display the elements. Accept a
number to be searched. Display whether the number is found or not in the array (LINEAR
SEARCH).

pg. 3 Programming Logic and Techniques


26. Write a program to store N elements in an array of integer. Display the elements. Sort the
elements. Accept a number to be searched. Display whether the number is found or not in
the array using BINARY SEARCH.

27. Write a program to store elements into a M * N matrix of integer. Display the matrix and its
transpose.

28. Write a program to store elements into a N * N matrix of integer. Display whether it is an
identity matrix or not.

29. Write a program to store elements into a N * N matrix of integer. Display whether it is a
symmetric matrix or not.

30. Write a program to add, subtract and multiply two matrices

31. Write the programs to generate the following outputs. In all the following cases, accept N:

*****
*****
*****
*****
:
N rows

11111
22222
33333
44444
:
N rows

12345
12345
12345
12345
:
N rows
*
**
***
****
:
N rows

pg. 4 Programming Logic and Techniques


32. Write the programs to generate the following outputs. In all the following cases, accept
N:

1
12
123
1234
:
N rows

1
22
333
4444
:
N rows

1
23
456
7 8 9 10
:
N rows
1
12
358
:
:
N rows

33. Write the programs to generate the following outputs. In all the following cases, accept
N:

1
‐4 9
‐16 25 ‐36
:
:
N rows

pg. 5 Programming Logic and Techniques


1
12
6 24 120
:
:
N rows
*
**
***
****
:
N rows
*
***
*****
********
:
N rows

34. Write a program to calculate the LCM of any no. of numbers

35. Write a program to add two numbers containing any number of digits.

36. Write a program to populate a matrix of order 4x4 with 14 unique random numbers

37. Write a program to check whether a matrix of order 4x4 contains the numbers in the
normal sequence (1, 2, 3, 4,.....15)

38. Write a program to check whether a matrix of order 8x8 contains queens that does not
cross each other path (8 queen problem)

pg. 6 Programming Logic and Techniques

You might also like