daily pastebin goal
41%
SHARE
TWEET

Untitled

a guest Mar 25th, 2019 65 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <iostream>
  2. #include <iomanip>
  3. using namespace std;
  4. void vidUgis();
  5. int main ()
  6. {
  7.     vidUgis();
  8.     return 0;
  9. }
  10.     void vidUgis(){
  11.     int n, un, i = 0, b = 0;
  12.     double ugisv = 0, ugism = 0, vidv = 0, vidm = 0;
  13.     cout << "Iveskite mokiniu skaiciu: "; cin >> n;
  14.     cout << "Iveskite ugius: " << endl;
  15.     while (n > 0){
  16.         cin >> un;
  17.         if (un > 0)
  18.         {
  19.             ugism = ugism + un;
  20.             b++;
  21.         }
  22.         else
  23.         {
  24.             ugisv = ugisv + un;
  25.             i++;
  26.         }
  27.         n--;
  28.     }
  29.     vidm = ugism / b;
  30.     vidv = ugisv * (-1) / i;
  31.     cout << "Vidmerginu - " << fixed << setprecision(1) << vidv << endl;
  32.     cout << "Vidvaikinu - " << fixed << setprecision(1) << vidm << endl;
  33.     cout << "merginu - " << b;
  34.     cout << "vaikinu - " << i;
  35. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top