0% found this document useful (0 votes)
2 views

Java - 2

The document outlines a series of programming tasks that require basic arithmetic operations such as printing strings, multiplying numbers, calculating sums and products, and finding squares and cubes. Each task includes a description, input format, constraints, and sample inputs and outputs. The tasks are designed to help learners practice fundamental programming concepts.

Uploaded by

masaidsa1
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

Java - 2

The document outlines a series of programming tasks that require basic arithmetic operations such as printing strings, multiplying numbers, calculating sums and products, and finding squares and cubes. Each task includes a description, input format, constraints, and sample inputs and outputs. The tasks are designed to help learners practice fundamental programming concepts.

Uploaded by

masaidsa1
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 12

1.

Print Masai School

Description

You need to print "Masai School" on a line, and print "A Transformation in Education" on a new line.

Input

No input

Output

Print "Masai School" on a line, and Print "A Transformation in Education" on a new line.

Sample Input 1
No Input

Sample Output 1
Masai School
A Transformation in Education

2. Multiply by 50 Ended

Description

● You are given a number stored in a variable, with the namenumber

● Multiply the number stored in the variablenumberby 50, and print the result obtained

Input

The first and the only line of the input contains the number stored in the variablenumber

Constraints

1 <= N <= 20

Output
Print a single number, the result obtained by multiplying it by 50

Sample Input 1
2

Sample Output 1
100

Hint

In the sample test case, the value stored in the variablenumberis 2. After, multiplying by 50, the answer

obtained is 100. Therefore, the answer obtained is 100.

3. Product of Six

Description

You are given six numbers, stored in variables with the following names

one, two, three, four, five, six

● Print the product of all the six numbers

Input

The first and the only line of the input contains 6 numbers stored in the variablesone, two, three,

four, five, six

Constraints

1 <= N <= 20

Output

Print a single integer, denoting the product of the six numbers given.

Sample Input 1
1 2 3 4 5 6

Sample Output 1
720

Hint

In the sample test case, the value of the variables is as follows

● one = 1

● two = 2

● three = 3

● four = 4

● five = 5

● six = 6

After, multiplying the six numbers, we get the following result1*2*3*4*5*6 = 720, which is the required

answer

4. Sum of five

Description

You are given five numbers stored in variables with the following names

one, two, three, four, five

● Find the sum of the five values, and print it

Input

The first and the only line of the input contains five values, stored in the variablesone, two, three,

four, five

Output
Print the sum of the five values stored in the variablesone, two, three, four, five

Sample Input 1
1 2 3 4 5

Sample Output 1
15

Hint

In the sample test case, the values stored in the variables areone = 1, two = 2, three = 3, four =

4, five= 5

The sum of the values is1 + 2 + 3 + 4 + 5 = 15, which is the required sum

5. Cube of a number Ended

Description

Given a number N, find its cube.

Input

The first and the only line of the input contains the number N.

Constraints

1 <= N <= 30

Output

Print the cube of a number.

Sample Input 1
2

Sample Output 1
8
6. Square and Sum Ended

Description

● You are given three numbers, stored in variables with the following names

one, two, three

● You have to find the square of the three numbers, and find the sum of their square values

Note : Square of a number, is a number multiplied by itself. For example, the


square of 3, is 3 * 3 = 9

Input

● The first and the only line of the input contains, the values stored inone, two, three

Output

● Print the sum of the squares of the values stored inone, two, three

Sample Input 1
1 2 3

Sample Output 1
14

Hint

In the sample test case, the value stored inone = 1, two = 2, three = 3.

The square of the values stored will be

one = 1 * 1 = 1

two = 2 * 2 = 4
three = 3 * 3 = 9

The resultant sum becomesone + two + three = 1 + 4 + 9 = 14, which is the required answer.

7. Find X Ended

Description

You are given a number X. Find the value of X, if

1. X is multiplied by 3

2. 10 is added to the new value of X.

Input

Input:

Input will contain one number X

Constraints:

0 < X < 1000

Output

Output:

Output should be the number X after performing above operations

Sample Input 1
3

Sample Output 1
19

Hint

Explanation

The value of X = 3, after multiplying with 3, X becomes 9, and then after adding 10, it becomes 19. So, the

output is 19

8. Operation on Numbers Ended

Description

You are given a number, stored in a variable with the namenumber. Perform the following operations on

the value stored in the number

1. Multiply the value by 3

2. Add 7 after it

3. Subtract 10 from it

After performing all the above operations, print the updated value

Input

The first and the only line of the input contains the number, stored in the variablenumber

Constraints

1 <= N <= 30

Output

Print a single integer, denoting the updated value of the number stored, after performing all the operations,

given in the problem statement


Sample Input 1
4

Sample Output 1
9

Hint

In the sample test case, the value stored in the variablenumberis 4.

● After multiplying the value by 3, the value gets updated to 12

● After that, we add 7 to it, so the number gets updated to 19

● Finally, we subtract 10 from it, so the value becomes 9, which is the final output

9. Square It Ended

Description

You are given an integer N, print its [square

value](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/pow)

(number raised to exponent 2)

Input

Input Format

First and the only line contains one integer N

Constraints

N<100

Output

Output an integer which is square of N


Sample Input 1
7

Sample Output 1
49

10. Find Product Ended

Description

You are given five numbers stored in variables with the following names

one, two, three, four, five

● Find the product of the five values, and print it

Input

The first and the only line of the input contains five values, stored in the variablesone, two, three,

four, five

Output

Print the product of the five values stored in the variablesone, two, three, four, five

Sample Input 1
1 2 3 4 5

Sample Output 1
120

Hint

In the sample test case, the values stored in the variables areone = 1, two = 2, three = 3, four =

4, five= 5
The sum of the values is1 * 2 * 3 * 4 * 5 = 120, which is the required sum

11. Double all Ended

Description

You are given five numbers, stored in the variables with the following names

one, two, three, four, five

● All the values are doubled, that is, they are multiplied by 2

Find the sum of the values stored inone, two, three, four, after the above operation are performed

Input

● The first and the only line of the input contains the values stored in variablesone, two,

three, four, five

Output

● Print the sum of the values stored inone, two, three, four,five, after the required

operation is performed

Sample Input 1
1 2 3 4 5

Sample Output 1
30

Hint

In the sample test case, the values stored in the variables are as follows

one = 1, two = 2, three = 3, four = 4, five = 5


After doubling all the values, the values become

one = 1*2 = 2

two = 2*2 = 4

three = 3*2 = 6

four = 4*2 = 8

five = 5*2 = 10

Therefore, the sum becomes2 + 4 + 6 + 8 + 10 = 30, which is the required output

12. Seven Numbers Ended

Description

You are given 7 numbers A, B, C, D, E, F, G. Find out the product of (A + B + C) and (D + E + F + G).

Input

Thefirst and the only line of the input contains A, B, C, D, E, F, and G.

Constraints

1 <= A, B, C, D, E, F, G <= 30

Output

Print the value of the expression (A + B + C) * (D + E + F + G)


Sample Input 1
1 2 3 4 5 6 7

Sample Output 1
132

Hint

The value of A = 1, B = 2, C = 3, D = 4, E = 5, F = 6, G = 7, Therefore the sum of (A + B + C) = 6, and that

of (D + E + F + G) = 22. Therefore, the product of (A + B + C) and that of (D + E + F + G) is equal to 6 x 22

= 132

You might also like