Logic(Array) in C#(V1.1)

  • Thread starter Thread starter Kondapanaidu
  • Start date Start date
K

Kondapanaidu

Hi,

What is the logic to compare Values.

First array={5,5,6,7};
Second array={5,3,3,2};

Explanation:
1.First array first element is greater than the second array first
element, No need to check remaining cases.
2.First Array First Element is same as second array First element then
we need to check first array second element to second array second
element.
3.If First Array second element is greater than the second array second
element no need to check remaining cases...

Remainig cases also same as the above...

Please do the help.

Thanks in Advance.

regards
 
Kondapanaidu said:
Hi,

What is the logic to compare Values.

First array={5,5,6,7};
Second array={5,3,3,2};

Explanation:
1.First array first element is greater than the second array first
element, No need to check remaining cases.
2.First Array First Element is same as second array First element then
we need to check first array second element to second array second
element.
3.If First Array second element is greater than the second array second
element no need to check remaining cases...

Remainig cases also same as the above...

Please do the help.

Thanks in Advance.

regards

Are the contents of the array elements always going to be integer? If so
convert them to a number with the same number of digits and then compare. So
in your example {5,5,6,7} = 5567 and {5,3,3,2} = 5332 and the check is (5567
5332), etc. Should simplify it.

If the elements are not always integer then you'll have to check the
elements using a loop unless c# has a built in function to do this that I'm
not aware of.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top