public/subjects/reverse_it
miguel 166a10990f fix(piscine-rust): add crates to exercises 2023-11-14 18:09:37 +00:00
..
README.md fix(piscine-rust): add crates to exercises 2023-11-14 18:09:37 +00:00
main.rs fix(piscine-rust): add crates to exercises 2023-11-14 18:09:37 +00:00

README.md

reverse_it

Instructions

Create a function named reverse_it, that takes a number. It should return a string with the number reversed, followed by the original number. If the number is negative, a - should be added to the beginning of the string.

Expected Functions

pub fn reverse_it(v: i32) -> String {
}

Usage

Here is a program to test your function,

use reverse_it::reverse_it;

fn main() {
    println!("{}", reverse_it(123));
    println!("{}", reverse_it(-123));
}

And its output:

$ cargo run
321123
-321123
$