Advertisement
Varasku

Kolejny program C++

Mar 6th, 2019
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.84 KB | None | 0 0
  1. #include <iostream>
  2. #include <iomanip>
  3. #include <cstdlib>
  4. #include <ctime>
  5. using namespace std;
  6. /* run this program using the console pauser or add your own getch, system("pause") or input loop */
  7.  
  8. int main(int argc, char** argv) {
  9. int przychody;
  10. int suma;
  11. int srednia;
  12. int min=0,max=0;
  13. for(int i=1;i<=12;i++)
  14. {
  15.  
  16.  
  17. cout<<"Podaj przychody ";
  18. cin>>przychody;
  19.  
  20. cout<<"Dochod z miesiaca"<<" "<<i<<" "<<"wynosi"<<" "<<przychody<<endl;
  21. suma+=przychody++;
  22. srednia=przychody % 12;
  23. if(przychody<0){
  24. min=przychody;
  25. max=przychody;
  26. }
  27.  
  28. if(przychody>max) max=przychody;
  29. if(przychody<min) min=przychody;
  30. }
  31. cout<<"Maksymalny dochod "<<max<<endl;
  32. cout<<"Minimalny dochod "<<min<<endl;
  33. cout<<"Suma dochodu "<<" "<<suma<<endl;
  34. cout<<"Srednia dochodu "<<" "<<srednia<<endl;
  35.  
  36.  
  37. system ("pause");
  38. return 0;
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement