19:reversenumber numbers upside down

Source: Internet
Author: User

Title Description

Description: Enter an integer that will output the integer in reverse order as a string

The program does not consider the case of negative numbers, if the number contains 0, then the reverse form also contains 0, if the input is 100, then the output is 001

Input Description: Enter an int integer

Output Description: The integer is output in reverse order in the form of a string

Input Example: 1516000

Output Example: 0006151

Live with StringBuilder's reverse ()

 Packageprctice01;ImportJava.util.Scanner;/*Title Description: Enter an integer, the integer in the form of a string to reverse the output program does not consider the case of negative numbers, if the number contains 0, the reverse form also contains 0, if the input is 100, then the output is 00 Input Description: Enter an int integer output description: This integer is reversed in the form of a string output input example: 1516000 Output Example: 0006151*/ Public classReverseNumber19 { Public Static voidMain (string[] args) {Scanner input=NewScanner (system.in);  while(Input.hasnextline ()) {Char[] num =input.nextline (). ToCharArray ();  for(inti = num.length-1;i>=0;i--) {System.out.print (num[i]); }        }    }}

19:reversenumber numbers upside down

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.