Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <limits>
- using namespace std;
- int main() {
- int N;
- cout << "Inserire N: ";
- cin >> N;
- int massimo = numeric_limits<int>::min();
- int minimo = numeric_limits<int>::max();
- int somma = 0;
- for(int i = 0; i < N; i++) {
- int temp;
- cin >> temp;
- somma = somma + temp;
- if(temp > massimo) massimo = temp;
- if(temp < minimo) minimo = temp;
- }
- cout << "Massimo: " << massimo << endl;
- cout << "Minimo: " << minimo << endl;
- cout << "Somma: " << somma << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement