[ create a new paste ] login | about

Link: http://codepad.org/8HL1ZxBZ    [ raw code | fork ]

C, pasted on Apr 21:
#include <stdio.h>
#include <stdlib.h>

int main()
{
    int set,testa,testb,count,k;

    printf("輸入一個正整數做質因數分解:");
    scanf("%d",&set);

    for(testa = 2 ; testa<=set ; testa++)
    {    //可省略
        count = 0;
        for(testb = 1 ; testb <= testa ; testb++)
        {//可省略
            if(testa%testb==0)
            {//可省略
                count++;
            }//可省略
        }//可省略
        if(count==2)
        {//可省略
            if(set%testa ==0)
            {//可省略
                for(k=1;k<=set;k++)
                {//可省略
                    if(set%testa^k==0)
                    {//可省略
                        printf("%d ",testa); 
                    } //可省略
                }//可省略
            } //可省略
        }//可省略
    }
    system("PAUSE"); 
    return 0;
}


Create a new paste based on this one


Comments: