kiem tien, kiem tien online, kiem tien truc tuyen, kiem tien tren mang
Tuesday, September 30, 2014

viết chương trình c nhập vào 1 số bất kì và kiểm tra xem nó có phải là số nguyên tố không

///chương trình kiểm tra 1 số có phải là sô nguyên tó không
#include<stdio.h>
#include<conio.h>
void kiemtrasonguyento(int n);
/// là số nguyên tố nếu nó không chia hết cho bất cứ số nào ngoài 1 và chính nó
void main()
{
int n;
printf("nhap so: ");
scanf_s("%d", &n);
kiemtrasonguyento(n);
_getch();
}
void kiemtrasonguyento(int n)
{
int dem = 0;
for (int i = 2; i < n; i++)if (n%i == 0) dem++;
if (dem == 0) printf("la so nguyen to");
else printf("khong phai la so nguyen to");
}

30 Sep 2014

0 comments:

Post a Comment

:) :)) ;(( :-) =)) ;( ;-( :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

Popular Posts