Computer Science, asked by viv822chow, 7 months ago


Q5. Write an algorithm -
i. To enter 2 numbers A and B as input and check whether the first number is bigger than
second, the first number is smaller than second or they both are equal
. They should also
print appropriate messages.




ANSWER THE QUESTIONS AND GET BRAINLIEST ANSWER.

Answers

Answered by ankitvishwakarma3928
5

Answer:

Given an array A[] and a number x, check for pair in A[] with sum as x

Write a program that, given an array A[] of n numbers and another number x, determines whether or not there exist two elements in S whose sum is exactly x.

Examples:

Input: arr[] = {0, -1, 2, -3, 1}

sum = -2

Output: -3, 1

If we calculate the sum of the output,

1 + (-3) = -2

Input: arr[] = {1, -2, 1, 0, 5}

sum = 0

Output: -1

No valid pair exists.

Explanation:

Mark as brilliant

Answered by AnindaBasu
3

Answer:

Step 1 : Start

Step 2 : Input the Two Number A and B

Step 3 : If A>B Then Goto Step 4 Else Goto Step 5

Step 4 : Print " A is Greater" Goto Step 9

Step 5 : Print " B is Greater" Goto Step 9

Step 6 : If A = B then Goto Step 7 else Goto Step 8

Step 7 : Print "Both are Equal" goto step 9

Step 8 : Print "Both are not Equal" goto step 9

Step 9 : Stop

Similar questions