To find the mass factor of integral type number

Source: Internet
Author: User

factorization (prime factor or mass factor): that is, in addition to 1 can be divisible by a given positive integer number.

prime numbers : The natural number in addition to 1 and it itself is no longer divisible by any other divisor.

Composite : The number of natural numbers can be divisible (excluding 0) by other numbers except by 1 and by itself.

Cases:

6 of the quality Factor is 2, 3. (6 = 2x3)

12 of the quality Factor is 2, 3. (= 2x2 x 3)

15 of the quality factor is 3, 5. (= 3x5)

Method of seeking mass factor:

The method of dividing the http://baike.baidu.com/view/255668.htm ()

Code:

1#include <stdio.h>2 3 intMain () {4     intn =0;5     inti; 6      while(N <2){7printf"\ n Please enter an integer greater than 1: \n\tn =");8scanf"%d", &n);9     }Tenprintf"the qualitative factors of \%d are: \n\t", n); One      for(i =2; I <=N;) { A            if(n% i = =0){ -printf"%d", i); -n = n/i; the}Else{ -i++; -         }  -        }      +     return 0; -}

Run result 1:
       

Run result 2:

         

To find the mass factor of integral type number

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.