Guest User

Untitled

a guest
Oct 14th, 2011
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.54 KB | None | 0 0
  1. #include <iostream>
  2. #include <math.h>
  3. #include <fstream>
  4. using namespace std;
  5.  
  6. int main() {
  7. int a, b, c;
  8.  
  9.  
  10. char z;
  11. do {
  12. cout<<"Ievadiet skaitli!"<<endl;
  13. cin>>a;
  14. for (b = sqrt(a);b > 1;b--)
  15. {
  16. c = a % b;
  17. if (c == 0)
  18. {
  19. cout<<a<<" nav pirmskaitlis."<<endl;
  20. break;
  21. }
  22. }
  23. if (b == 1)
  24. {
  25. cout<<a<<" ir pirmskaitlis."<<endl;
  26. }
  27. cout<<"Continue? (y/n)"<<endl;
  28. cin>>z;
  29. } while (z != 'n');
  30. return (0);
  31. }
  32.  
  33.  
Advertisement
Add Comment
Please, Sign In to add comment