A table containing decimal nos. from 1 to 100 and their
roman Equivalent was given. We were required to write a
function : char* ConverToRoman(int number) : to
convert the given number( 1<=number<=100) into its numerical
equivalent.
I want a solution in C/C++ language
Answer Posted / monu rohila
public static string GetPalindromeString(string theInputString)
{
int j = 0;
int k = 0;
string aPalindrome = string.Empty;
string aLongestPalindrome = string.Empty ;
for (int i = 1; i < theInputString.Length; i++)
{
k = i + 1;
j = i - 1;
while (j >= 0 && k < theInputString.Length)
{
if (theInputString[j] != theInputString[k])
{
break;
}
else
{
j--;
k++;
}
aPalindrome = theInputString.Substring(j + 1, k - j - 1);
if (aPalindrome.Length > aLongestPalindrome.Length)
{
aLongestPalindrome = aPalindrome;
}
}
}
return aLongestPalindrome;
}
`
| Is This Answer Correct ? | 1 Yes | 14 No |
Post New Answer View All Answers
Current/most recent employer (Please state full names and address including Country and post code) Current Position Held When would you be available to start work? ONLINE INTERVIEW [INSTRUCTIONS: Give brief answers to all the under listed questions] QUESTIONS ANSWER SPACE 1) What are your years of experience? 2) How do you approach a technical problem? Give an example. How long do you think it would be before you will make a significant contribution to the team/company?
What is the selling price of a car? If the cost of the car is Rs.60 and a profit of 10% over selling price is earned.
A building with height D shadow upto G. What is the height of a neighbouring building with a shadow of C
There is a room with 6' x 8'. A 1' tile is fixed along the 4 walls in one row. How many 1" tiles require to finish the work.
If a man can swim downstream at 6kmph and upstream at 2kmph, his speed in still water is: It takes 30 days to fill a laboratory dish with bacteria. If the size of the bactiria doubles each day, how long did it take for the bactiria to fill one half of dish?
What is the selling price of can cost selling price of .. cost .. is Rs 60 ,10% profit over selling price ?
Each side of a rectangle is increased by 100% .By what percentage does the area increase?
If a ball falls from 16 feet takes 4 seconds. How much time it will take when falls fron 64 feets.
Seven members sat around a table for three days for a conference. The member's names were Abhishek, Amol, Ankur, Anurag, Bhuwan ,Vasu and Vikram. The meetings were chaired by Vikram. On the first evening members sat around the table alphabetically. On the following two nights, Vikram arranged the seating so that he could have Abhishek as near to him as possible and absent minded Vasu as far away as he could. On no evening did any person have sitting next to him a person who had previously been his neighbor. How did Vikram manage to seat everybody to the best advantage on the second and third evenings?
The diameter of a wheel is 1.26m. If this wheel rotates 500 rotations, how long it can travel?
From 5 different green balls, four different blue balls and three different red balls, how many combinations of balls can be chosen taking at least one green and one blue ball?
How many five digit numbers are there such that two left most digits are even and remaining are odd?
A man shows his friend a woman sitting in a park and says that she the daughter of my grandmother's only son. What is the relation between the two
Two pencils costs 8 cents, then 5 pencils cost how much
A chain is broken into three pieces of equal lenths containing 3 links each. It is taken to a backsmith to join into a single continuous one . How many links are to to be opened to make it ?