Advertisement
Guest User

Nina2

a guest
May 20th, 2018
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.24 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7. //1. Broevi so edinica 0
  8. for(int i=100; i<=999; i++)
  9. {
  10. if(i%10==0) cout << i << endl;
  11. }
  12.  
  13.  
  14. //2. X na n
  15. int x, n, br=1;
  16. cout << "Vnesi broj: ";
  17. cin >> x;
  18. cout << "Vnesi stepen: ";
  19. cin >> n;
  20. for(int i=1; i<=n; i++)
  21. {
  22. br*=x;
  23. }
  24. cout << x << "^" << n << "=" << br;
  25.  
  26.  
  27. //3. Broj na pozitivni/negativni
  28. int brP=0, brN=0,a;
  29. for(int i=1; i<=10; i++)
  30. {
  31. cin >> a;
  32. if(a>0) brP++;
  33. else brN++;
  34. }
  35. if(brP>brN) cout << "Vneseni se poveke pozitvni broevi";
  36. else cout << "Vneseni se poveke negativni broevi";
  37.  
  38.  
  39. //4. Broj na parni vo opseg
  40. int b, c, parni=0;
  41. cout << "Vnesi opseg: "
  42. cin >> b >> c;
  43. if (c>b)
  44. {
  45. int temp=c;
  46. c=b;
  47. b=temp;
  48. }
  49. for( ;b<=c; b++)
  50. {
  51. if(b%2==0) parni++;
  52. }
  53. cout << "Vo toj opseg ima " << parni << "broevi"
  54.  
  55.  
  56. //5. Deliteli
  57. int d;
  58. cout << "Vnesi broj: ";
  59. cin >> d;
  60. cout << "Deliteli na " << d << "se:" << endl;
  61. for(int i=1; i<=d; i++)
  62. {
  63. if(d%i==0) cout << i << endl;
  64. }
  65. return 0;
  66. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement