Vous êtes sur la page 1sur 4

PROBLEM 1

Create a Program that will require a user to enter a number and reverse the digits of it and add the
resulting number to the original number entered by the user. If the output of result is not a
palindrome, repeat the process. In the example below, start with 78. Affecting this process, we
obtain:
78 + 87 = 165
165 + 561 = 726
726 + 627 = 1353
1353 + 3531 = 4884, a palindrome

INPUT: Any positive integer

OUTPUT: Display all the occurrences acquired in the addition process. Print the
palindrome produced. If the produced sum is not palindrome after 10 additions, the
program will display that it did not found any palindrome sum.

SAMPLE INPUT 1

SAMPLE OUTPUT 1

SAMPLE INPUT 2

SAMPLE OUTPUT 2
PROBLEM 2

Write a program that will generate an inverted numbers ladder. The user is required to enter any
positive integer that is not greater than 100. The output must be displayed in a single dialog box,
not in a terminal window.

SAMPLE INPUT

Enter an integer: 5

SAMPLE OUTPUT

5 4 3 2 1
4 3 2 1
3 2 1
2 1
1
PROBLEM 3

Write a program to multiply two matrices of the same size. The user will enter the size of the two
matrices and the elements of these matrices.

SAMPLE INPUT

Enter the size of the matrix: 2


Enter the elements of the first matrix: 2
3
4
5
Enter elements of the second matrix: 1
2
3
4

SAMPLE OUTPUT

11 16

19 28
PROBLEM 4
1. BACKGROUND:
A waste management unit is looking for a developer who can develop system app that
can segregate the waste in the area. Let a string be the waste and the characters as the
classifications.

SPECIFICATION:
The input is composed of upper case, lower case, special characters, integers, and
spaces. The system will segregate and count the number of upper case, lower case, special
characters, integers and spaces. Another feature of it is that it automatically gets the sum of the
integers in the input.

Sample Input: Sample Output:


ABde123*_ 67 Input is: ABde123*_ 67
No. of Lower Case: 2
No. of Upper Case: 2
No. of Integer: 5
No. of Special Characters: 2
No. of Spaces: 1
Sum of Integers: 19

Vous aimerez peut-être aussi