Advertisement
Guest User

Untitled

a guest
Oct 15th, 2019
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.70 KB | None | 0 0
  1. #include <iostream>
  2. #include <stdlib.h>
  3. #include <time.h>
  4. #include <windows.h>
  5.  
  6. using namespace std;
  7.  
  8. int main()
  9. {
  10. srand(time(NULL));
  11.  
  12. /*int n = 0;
  13. cin >> n;
  14. int mas[n];
  15. int pirminiai = 0;
  16. int sk = 1;
  17. while(pirminiai < n){
  18. sk++;
  19. int dalikliai = 0;
  20. for(int i = 2; i <= sk; i++){
  21. if(sk % i == 0){
  22. dalikliai++;
  23. }
  24. }
  25. if(dalikliai == 1){
  26. bool arYra = false;
  27. for(int i = 0; i < pirminiai; i++){
  28. if(mas[i] == sk){
  29. arYra = true;
  30. }
  31. }
  32. if(!arYra){
  33. mas[pirminiai] = sk;
  34. pirminiai++;
  35. }
  36. }
  37. }
  38. for(int i = 0; i < n; i++){
  39. cout << mas[i] << " " << endl;
  40. }*/
  41.  
  42. /*int n;
  43. cin >> n;
  44. int arr[n];
  45. int lyg = 0;
  46. int nelyg = 0;
  47.  
  48. for(int i = 0; i < n; i++){
  49. arr[i] = rand() % 4900 + 10;
  50. }
  51.  
  52. for(int i = 1; i < n; i++){
  53. if(arr[i] % 2 == 0){
  54. lyg++;
  55. } else if (arr[i] % 2 != 0){
  56. nelyg++;
  57. }
  58. }
  59.  
  60. int lygarr[lyg];
  61. int nelygarr[nelyg];
  62.  
  63. lyg = 0;
  64. nelyg = 0;
  65. for(int i = 1; i < n; i++){
  66. if(arr[i] % 2 == 0){
  67. lygarr[lyg] = arr[i];
  68. lyg++;
  69. } else if (arr[i] % 2 != 0){
  70. nelygarr[nelyg] = arr[i];
  71. nelyg++;
  72. }
  73. }
  74.  
  75. system("cls");
  76.  
  77. for(int i = 0; i < lyg; i++){
  78. cout << lygarr[i] << " ";
  79. }
  80. cout << endl;
  81. for(int i = 0; i < nelyg; i++){
  82. cout << nelygarr[i] << " ";
  83. }*/
  84.  
  85.  
  86. return 0;
  87. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement