43 lines
564 B
C
43 lines
564 B
C
|
#include <stdio.h>
|
|||
|
#include <stdlib.h>
|
|||
|
|
|||
|
void factor(int n , int i ){
|
|||
|
int count = 0;
|
|||
|
|
|||
|
if(n==i) {
|
|||
|
printf(" x %d",i);
|
|||
|
return;
|
|||
|
}
|
|||
|
|
|||
|
if(n<=1) return;
|
|||
|
|
|||
|
while (n % i ==0){
|
|||
|
count++;
|
|||
|
n /= i;
|
|||
|
}
|
|||
|
|
|||
|
if(count>1 ) printf(" x %d^%d",i,count);
|
|||
|
else if (count==1 ) printf(" x %d",i);
|
|||
|
|
|||
|
factor(n , i+1);
|
|||
|
}
|
|||
|
|
|||
|
int main(){
|
|||
|
int i= 2 , n ;
|
|||
|
printf("<EFBFBD><EFBFBD><EFBFBD>J<EFBFBD>@<40>ӥ<EFBFBD><D3A5><EFBFBD><EFBFBD>ƨöi<C3B6><69><EFBFBD>]<5D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n");
|
|||
|
printf("<EFBFBD><EFBFBD><EFBFBD>J<EFBFBD>Ʀr ==> ");
|
|||
|
scanf("%d",&n);
|
|||
|
if(n==2) {
|
|||
|
printf("\n%d = 1 x 2",n);
|
|||
|
}else{
|
|||
|
printf("\n%d = 1",n);
|
|||
|
}
|
|||
|
|
|||
|
factor(n,i);
|
|||
|
|
|||
|
printf("\n");
|
|||
|
system("pause");
|
|||
|
|
|||
|
return 0;
|
|||
|
}
|