Posts

Showing posts with the label Reverse

C++ Code to Reverse a Number

Image
Reverse a Number using C++ * Featured Code Example Created by  tooselfish . C++ #include <iostream> int main() {     int a, b, c = 0;          // input a whole integer     // for example: 2485     std::cin >> b;          // for input failure     if( std::cin.fail() ){         std::cerr << "Wrong input!\n";         return 1;     }          std::cout << "Your number input : " << b << std::endl;          // reverse the input     while (b != 0){         a = b % 10;         c = ( c * 10 ) + a;         b = b / 10;     }          // output the reverse     std::cout << "The rev...

Java Code to Reverse a Number

Image
Reverse a Number using Java Java import java.util.Scanner;  class ReverseNumber {  public static void main(String args[]) {  int num=0;  int revnum =0;  System.out.println("Input your number and press enter: ");  Scanner in = new Scanner(System.in);  num = in.nextInt();  while( num != 0 ) {  revnum = revnum * 10;  revnum = revnum + num%10;  num = num/10; }  System.out.println("Reverse of input number is: "+revnum); } } 🎉CONGRATULATIONS YOU FOUND THE EASTER EGG!!!🎉 The winning message is "Talk is cheap. Show me the code." - Linus Torvalds 🤓 Click here to run this code More Free Code Examples: Java Code to Reverse a String Java Current Time and Date Program Javascript Easy Battleship Game

Java Code to Reverse a String

Image
Reverse a String using Java Java public class Reverse {  public static void main(String[] args) {  String str = "Reverse this string";  String reversed = reverseString(str); System.out.println("The reversed string is: " + reversed); }  public static String  reverseString(String str) {  if (str.isEmpty())  return str;  return reverseString(str.substring(1)) + str.charAt(0); } }   Click here to see this code run More Free Code Examples: Hello World in 10 Programming Languages Java Odd or Even Java Current Time and Date Program

C++ Code to Reverse a String

Image
Reverse a String using C++ * Featured Code Example Created and submitted by  Nitrocell  via Sololearn. C++ #include <iostream> #include <string> #include <algorithm> using namespace std; void ReverseSystem() {     cout << "Type what you want to reverse: " << endl;     string tool;     cin >> tool;     reverse(tool.begin(), tool.end());     cout << "Reverse:\n\n" << tool << endl; } int main(void) {     ReverseSystem();            return 0; } Click here to run this code More Free Code Examples: Python Code to Reverse a String C++ Guess the Number C++ Odd or Even

Python Code to Reverse a String

Image
Reverse a String using Python * Featured Code Example Created and submitted by  Nitrocell  via Sololearn. Python tool = input() print("===============Result===============\n\n") print("Normal: " + tool + "\n") print("Reverse: " + tool[::-1]) Click here to run this code More Free Code Examples: C++- Code to Reverse A String Hello World in 10 Programming Languages 8 Codes to Find Versions