How to decompose a positive integer into factorization multiplication (Java)

Source: Internet
Author: User

 PackageCom.hpu.bai;/*** This program is used to decompose a positive integer into factorization multiplied by a = 2*2*5;@authorBai **/ Public classByprime { Public Static intPrimeintm) {            intK = 2;intCount =0; System.out.print (M+"=");  while(k<=m) {                if(k = =m)                    {System.out.print (M); Count+=1;  Break; }Else                if(M%k ==0) {System.out.print (k+"*"); Count+=1; M= m/K; }Else{k++; }    }            returncount;} Public Static voidMain (string[] args) {intCount = Prime (29); if(Count ==1) {System.out.println ("This is a prime number"); }ElseSystem.out.println ("This is a composite");}} AC QQ623687677 java Beginner

How to decompose a positive integer into factorization multiplication (Java)

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.