Phoenix_x

Untitled

Jan 8th, 2018
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.43 KB | None | 0 0
  1. #include "stdafx.h"
  2. #include <iostream> //cin cout
  3.  
  4. using namespace std;
  5.  
  6. void main()
  7. {
  8.     //тип име [брой елементи]
  9.     int abc[10] = {1, 8, 4 ,10 ,-15, 0, -156, 8, 5, 0};
  10.  
  11.     int suma_otricatelni = 0; //сума винаги 0
  12.  
  13.     for (int i = 0; i < 10; i++)
  14.     {
  15.         if (abc[i] < 0)
  16.         {
  17.             suma_otricatelni = suma_otricatelni + abc[i];
  18.         }
  19.     }
  20.  
  21.     cout << "Suma na otricatelni" << suma_otricatelni << endl;
  22. }
Advertisement
Add Comment
Please, Sign In to add comment