Prime number Factor

Source: Internet
Author: User

Function: Enter a positive integer that outputs all of its prime number factors in order from small to large (for example, a prime factor of 180 is 2 2 3 3 5)

Detailed Description:


Function Interface Description:

Public String GetResult (long Uldatainput)

Input parameters:

Long uldatainput: The positive integer entered

return value:

String

Input Description:

Enter a long integer



Output Description:

A factor that outputs all of its prime numbers in order from small to large, separated by a space

Input Example:
180

Output Example:
2 2 3) 3 5

1 //ConsoleApplication4.cpp: Defines the entry point of the console application. 2 //3 4#include"stdafx.h"5 6#include <iostream>7 8 using namespacestd;9 Ten intMainvoid) One { A     Longvalue; -      while(Cin >>value) -     { the          while(Value! =1) -         { -              for(inti =2; I <= value; i++) -             { +                 if(value%i = =0) -                 { +Value/=i; Acout << i <<' '; at                      Break; -                 } -             } -         } -     } -  in     return 0; -}

Prime number Factor

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.