[codes=c]#include <stdio.h>
#include <conio.h>
int ktnt (int a)
{
if(a<2) return 0;
for(int i=2;i<a;i++)
if(a%i==0) return 0;
return 1;
}
int main()
{
int n;
printf("nhap n: ");
scanf("%d",&n);
printf("cac so nguyen to trong khoang 1-> %d la:\n",n);
int tam=0;
while(tam<n)
{
if(ktnt(tam)==1)
printf("%4d",tam);
tam++;
}
getch();
}[/codes]
Last modified on March 31st, 2021 at 1:10 am
Nam Le
lequocnam
0 responds