Professional Documents
Culture Documents
hw5 - 1
hw5 - 1
: .1
( )T(n
(1)
n > 1 ,T(1) = 1
:( 0-
. T (n) = 2T ( n / 4 ) + 5
: .x x
. 5.1 = 6, 2.9 = 3, 12 .0 =12
: n=10
n
.(T(n
(int T(int n
:
,
.math.h ceil
.(T(n
(2)
:( , )
#include <stdio.h>
#include <math.h>
.2 :
,
)(1
" , .
, 50 .5 5 2
.
.5 2 :
(void factor_rec(int n :
:
) (1-
.
.
, ,
, .
)(
.
) ,(:
Please enter a positive integer:
168
The prime factors of 168 are 2 3 7
>#include<stdio.h
>#include<math.h
)(int main
{
;int x
;)"printf("please enter a positive integer: \n
;)scanf_s("%d",&x
;)printf("the prime factors of %d are: \n",x
factor_rec(x);
return 0;
}