irapilguy

Untitled

Jan 30th, 2021
934
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.22 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. void main()
  5. {
  6.     int ar[10];
  7.     int sum = 0;
  8.  
  9.     for (int i = 0; i<10; i++)
  10.         ar[i] = i + 1;
  11.  
  12.     for (int i = 0; i<10; i++)
  13.     if (i % 2 != 0)
  14.         sum += ar[i];
  15.  
  16.     cout << sum;
  17. }
  18.  
Advertisement
Add Comment
Please, Sign In to add comment