Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //
- // main.cpp
- // 01
- //
- // Created by Petr Kalab on 03.10.12.
- // Copyright (c) 2012 Petr Kalab. All rights reserved.
- //
- // Sčítání čísel v poli
- #include <iostream>
- using namespace std;
- int main(int argc, const char * argv[])
- {
- int i = 0;
- int x = 0;
- int y = 0;
- cout << "Zadej velikost pole ";
- cin >> i;
- int pole[i];
- for(int a=0; a<i;a++)
- {
- cout << "Zadej "<< a+1 << " cislo: ";
- cin >> x;
- pole[a] = x;
- }
- for(int b=0;b<i;b++)
- {
- y = y + pole[b];
- }
- cout << "Sečtená čísla v poli jsou: " << y;
- return 0;
- }
Add Comment
Please, Sign In to add comment