kiem tien, kiem tien online, kiem tien truc tuyen, kiem tien tren mang
Thứ Năm, 13 tháng 3, 2014

Đề bài: nhập vào số nguyên dương n. Phân tích số nguyên n ra các thừa số nguyên tố. Ví dụ: n = 28 thì phân tích thành 2 x 2 x 7, n = 15 thì phân tích thành 3 x 5, n = 11 thì phân tích ra 11.

Video:

)

#include <stdio.h>

int
main(){
int
n;
printf("n = ");
scanf("%d",&n);

printf("\n\n %d = ",n);
for
(int i=2;n>1; ){
/* if (n == i){ // n / n = 1 -> dieu kien cua dung
printf("%d ", i);
break;
}*/

if
(n % i == 0){
printf("%d",i);
n=n/i;
if
(n>1)
printf(" x ");
}

else
{
i++;
}
}

return
0;
}
13 Mar 2014

0 nhận xét:

Đăng nhận xét

:) :)) ;(( :-) =)) ;( ;-( :d :-d @-) :p :o :>) (o) [-( :-? (p) :-s (m) 8-) :-t :-b b-( :-# =p~ $-) (b) (f) x-) (k) (h) (c) cheer
Click to see the code!
To insert emoticon you must added at least one space before the code.

domain, domain name, premium domain name for sales

Bài đăng phổ biến