hi! i am trying to write a program that takes a long integer and compares every pair in that integer and displays largest pair. e.g we have an integer 23812 and in this integer largest pair is 81. so program should display 81. but i have no logic in mind for this program. please help me

Recommended Answers

All 5 Replies

  1. Convert number to string.
  2. Create array of pairs in the string.
  3. Convert array members to integers.
  4. Iterate array to find largest member.

hi! rubber man. actually i and my friend are trying to solve this problem. i have a confusion that how to create pairs in the string. plz guide me

Sorry, but I don't do your homework for you. I provided a pseudo-code algorithm to solve the problem. Write the code, and post it here with errors that you encounter. Then we may be able to help.

You should look into how to get characters from strings, how to convert a group of characters into a string, how to convert a number to a string, and how to convert a string into a number. A simple goolge search should tell you how to do those things

I agree with the previous user that if you have such doubts in the program flow, you can simply give a search. Or you can just refer some good books providing theinformation about converting the datatypes.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.