Advertisement
Josif_tepe

Untitled

Jun 1st, 2021
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.60 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main()
  5. {
  6. int n;
  7. cin >> n;
  8. int niza[n];
  9. for(int i = 0; i < n; i++) {
  10. cin >> niza[i];
  11. }
  12. int najgolem = niza[0];
  13. int najmal = niza[0];
  14. for(int i = 0; i < n; i++) {
  15. if(niza[i] > najgolem) {
  16. najgolem = niza[i];
  17. }
  18. if(niza[i] < najmal) {
  19. najmal = niza[i];
  20. }
  21. }
  22. cout << "Najgolemiot broj e: " << najgolem << endl;
  23. cout << "Najmaliot broj e: " << najmal << endl;
  24. cout << "Razlikata nivna e: " << najgolem - najmal << endl;
  25. return 0;
  26. }
  27.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement