Advertisement
81gl-ntd

Thuật toán tìm SNT c++

Nov 21st, 2014
158
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.29 KB | None | 0 0
  1.  
  2. #include <iostream>
  3. #include <conio.h>
  4. #include <cmath>
  5.  
  6. using namespace std;
  7. int main()
  8. {
  9. int n,i;
  10. cout<<"nhap n=";
  11. cin>>n;
  12. int laSNT=1;
  13. for (i=0;i<=sqrt(n) && laSNT;i++)
  14. laSNT=n%i;
  15. if (laSNT)
  16. cout<<n<<" la so nguyen to";
  17. getch();
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement