Posts

Showing posts with the label Reverse

In Python, Print Tokens In Reverse Order

Image
Download

In Java, Multiple String Operations With Single Scanner Object

Image
 Problem Statement: Write a method named site. This method accepts the Scanner object as its parameter. This method reads a commercial website URL that starts with www and ends with .edu or .com. This method retrieves the name of the site and outputs the site without the www prefix and the domain suffix. If the user enters www.yahoo.com then this method outputs yahoo. Write a method called decrypt that accepts a Scanner object as its parameter. this method reads an encrypted word and then decrypts the word. Here is the decryption algorithm: only the even numbered characters should be counted as the part of the word. Other characters should be discarded. For example if the user enters: hwealxlaod then the decrypted word is HELLO. Pay attention that the decrypted word is all in capital letters. Write a method called reverse that accepts the Scanner object as its parameter. This method asks the user for the entire name and prints the name in the reverse order. You must only use nextL...

How to print reverse string in Java recursively?

Image
public class Reverse{ public static void main(String[]args){ doubleReverse("Java"); } public static void doubleReverse(String s){ int l = 0; if(null == s || 0 == (l = s.length())) return; char c = s.charAt(--l); System.out.printf("%c%c", c, c); s = s.substring(0,l); doubleReverse(s); } } Download

✔ Learn C in 2 hours ⚡ C Programming for beginners 🔥 Tecq Mate Tutorials ✌

Image

C Program print each line in reverse order

Image
Download code here