Java_ prints integers from one count to another, and every 5 is a row

Source: Internet
Author: User

1 ImportJava.util.Scanner;2 3  Public classdayin_100 {4      Public Static voidMain (string[] args) {5System.out.println ("Enter the first number of integers you want to print:");6Scanner San1 =NewScanner (system.in);7System.out.println ("Please enter the mantissa of the integer to be printed:");8Scanner San =NewScanner (system.in);9         intNUM1 =San1. Nextint ();Ten         intNum =San. Nextint (); One Dayin (num1,num); A     } -      Public Static voidDayin (intSUM1,intSUM) {//Packaging Printing Methods -         intx = 0; the          for(intI =sum1; I <= sum; i++) { -             intA= i%10;//determine if the digits have a number 9 -             intB= i/10%10;//determine if 10 digits have a number 9 -             intC= i/10/10%10;//determine if the hundred have a number 9 +             if(a!=9 && b!=9 && c!=9) {//when none of them contain 9 o'clock, go to print -System.out.print (i+ "\ T"); +x + +;//records an index value when the index is wrapped every 5 o'clock A                 if(x%5==0){ at System.out.println (); -                 } -             } -         } -     } -}

The output is:

Please enter the first number of integers to be printed: 5
Please enter the mantissa of the integer to be printed: 50

5 6 7) 8 10
1112131415
1617182021
2223242526
2728303132
3334353637
3840414243
4445464748
50

Java_ prints an integer from one count to another, and every 5 is a line

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.