Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Kiem tra so nguyen to_By CQH
- //Trinh Cong Quang_12520344
- #include <stdio.h>
- #include <math.h>
- #include <conio.h>
- void main()
- {
- int n, i,j=0;
- while(n<=0)
- {
- printf("Vui long nhap vao so nguyen duong can kiem tra\n\n");
- scanf("%d", &n);
- }
- if(n==1)
- printf("%d khong phai la so nguyen to\n",n);
- else
- for(i=2;i<=(int)sqrt(n);i++)
- if(n%i==0)
- {
- j=1;
- break;
- }
- if(j==1)
- printf("%d khong phai la so nguyen to\n\n",n);
- else
- printf("%d la so nguyen to\n\n",n);
- getch();
- }
Advertisement
Add Comment
Please, Sign In to add comment