Use for loop
declare string array str[] and string variable
l= string length of string array
j=l
for i=0 to i=l/2 then
temp=str[i]
str[i]=str[j-1]
str[j-1]=temp
j=j-1
now print str array it will be reversed
write the javascript code to display the reverse no. of given no. (e.g. 247 reverse of 742)
No.
.... String line = "This is example program with spaces"; String[] tokens = line.split(" "); System.out.println(tokens.length-1); .......
One way to do this is to convert the number to a String, then use the corresponding String method to find out the length of the String.
This functionality is already in Java. String.toLowerCase() and String.toUpperCase() will take care of it for you.
Reverse the string and compare it to the original. If they match, then it is a palindrome.
Check the documentation of the String class, for a method that searches for a substring.
You find a language that can be targeted towards the .NET Framework. What you are suggesting is something related to string manipulation and you can work with delimiters.
To reverse a number, first convert the number to a string, then reverse the string. Given your number consists of alphanumeric characters, the number must already be a string so simply reverse the string: #include<string> using std::string; string reverse (const string& s) { string str {}; for (auto c : s) str.insert (str.begin(), c); return str; } int main () { std::cout << "Enter a number: "; string s {}; std::cin >> s; std::cout << "The number in reverse is: " << reverse (s); }
8086 assembly language program to check wether given number is perfect or not
Use the tolower() function. Example: char* a = 'X'; a = tolower(a); printf("%c", a);
a write the algorithm to concatenate two given string