Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Search & Filtering

Compute Hypotenuse

Write a program to find the hypotenuse 

H of a right-angled triangle of sides A and B.

Note: Pythagoras theorem states that, for a right-angled triangle. Hypotenuse2 = A2 + B2

Input

The first line is an integer, 

A. The second line is an integer, B.

Output

The output should be an integer.

Explanation

In the given example, the first side 

A = 3, and the second side B = 4. To calculate the hypotenuse we use Pythagoras theorem.

According to Pythagoras theorem, hypotenuse2 = 32 + 42

Therefore, the hypotenuse value is 

5. So, the output should be 5.

Sample Input 1
3
4
Sample Output 1
5
Sample Input 2
12
5
Sample Output 2
13

Print Integers - 3

Given an integer 

N. Write a program to print integers from N to 1.

Input

The first line of input is an integer 

N.

Explanation

In the given example, 

N = 5 the integers from 5 to 1 are 5, 4, 3, 2, 1.

Therefore, the output should be 

5
4
3
2
1
Sample Input 1
5
Sample Output 1
5
4
3
2
1
Sample Input 2
3
Sample Output 2
3
2
1

Solid Right Angled Triangle - 2

Given an integer number 

N as input. Write a program to print the double triangular pattern of N lines using an asterisk(*) character as shown below.

Note: There is a space after each asterisk * character.

Input

The first line of input will contain a positive integer.

Explanation

Given 

N = 4, there should be 2 triangular patterns with 4 lines each. So, the output should be

* 
* * 
* * * 
* * * * 
* 
* * 
* * * 
* * * *
Sample Input 1
4
Sample Output 1
* 
* * 
* * * 
* * * * 
* 
* * 
* * * 
* * * *
Sample Input 2
5
Sample Output 2
* 
* * 
* * * 
* * * * 
* * * * * 
* 
* * 
* * * 
* * * * 
* * * * *

when we give " python foundations " as input,we got "-" between the words.can you help me to resolve it?
Develop the internal mark calculation system based on the attendance percentage using java on given condition attendance percentage>=80and<90-4 marks attendance percentage>=75and<80-3 marks,attendance percentage<75-0 marks

A manufacturer uses 1000 bytes as the value of 1K bytes, 1000K bytes as the value of 1MB, 1000MB as the value of 1GB. However, in computer memory, 1KB is equal to 1024 bytes. So the actual storage on a 40GB hard drive is approximately 37.25GB. Write a program that prompts the user to enter the size of the hard drive specified by the manufacturer, on the hard drive box, and outputs the actual storage capacity of the hard drive.

Input

User will need to input the hard drive size in gigabytes. Input the size after the text "Enter hard drive size in giga bytes: ".

Output

The output will be the hard drive size and the actual hard drive storage capacity. The program shall output the hard drive size inputted by the user after the "Hard drive size = ". It'll be followed by the string "Actual hard drive storage capacity = " and the actual hard drive storage capacity computed.


Sample Output

Hard drive size = 704 GB

Actual hard drive storage capacity = 655.651 GB


Program

Create a program that asks for the student's score and the number of items in a laboratory exercise. It will then compute for the grade using the formula. I recommend you to study and review on our lesson on Datatypes and Variables (Identifier).

Input

The user is required to enter two (2) inputs where the first input is the student score and the second one is the total number of items.

Output

The program will display the solution or formula (Score / Total # of Items) x 60 + 40 followed by an equal sign then the equivalent laboratory grade with two decimal places of the student. (Refer to the sample output)

++++++++++++++++++++++++++++++

Sample Input #1

21 40

Sample Output #1

(21/40)x60+40=71.50


Write a program to demonstrate external merge sort

Given an integer value

N as input, write a program to print a shaded diamond of 2*N -1 rows using an asterisk(*) character as shown below.Note: There is a space after each asterisk (*) character.Input

The first line of input is an integer

N.Explanation

In the given example

N = 5. Therefore, the output should be 

     * 
    * * 
   * * * 
  * * * * 
 * * * * * 
* * * * * * 
 *       *
  *     *
   *   *
    * *
     *

Program

Create a program that asks for the student's score and the number of items in a laboratory exercise. It will then compute for the grade using the formula.

Input

The user is required to enter two (2) inputs where the first input is the student score and the second one is the total number of items.

Output

The program will display the solution or formula (Score / Total # of Items) x 60 + 40 followed by an equal sign then the equivalent laboratory grade with two decimal places of the student. (Refer to the sample output)

++++++++++++++++++++++++++++++

Sample Input #1

15 20

Sample Output #1

(15/20)x60+40=85.00

++++++++++++++++++++++++++++++

Sample Input #2

21 40

Sample Output #2

(21/40)x60+40=71.50


LATEST TUTORIALS
APPROVED BY CLIENTS