more tablice
This commit is contained in:
parent
d4d993cb71
commit
5186ec87bf
2 changed files with 47 additions and 0 deletions
23
6-tablice/2/main.cpp
Normal file
23
6-tablice/2/main.cpp
Normal file
|
@ -0,0 +1,23 @@
|
|||
/*
|
||||
Zadeklaruj tablice 5 liczb calkowitych, wczytaj i wypisz je na ekranie
|
||||
*/
|
||||
|
||||
#include <iostream>
|
||||
|
||||
using namespace std;
|
||||
|
||||
int main() {
|
||||
int arr[5];
|
||||
|
||||
cout << "Podaj 5 liczb calkowitych: " << endl;
|
||||
|
||||
for(int i = 0; i <= 4; i++) {
|
||||
cout << "Wpisz liczbe " << i+1 <<": ";
|
||||
cin >> arr[i];
|
||||
}
|
||||
cout << "Podane liczby to: ";
|
||||
for(int i = 0; i <= 4; i++) {
|
||||
cout << arr[i] << " ";
|
||||
}
|
||||
|
||||
}
|
24
6-tablice/3/main.cpp
Normal file
24
6-tablice/3/main.cpp
Normal file
|
@ -0,0 +1,24 @@
|
|||
/*
|
||||
Wczytaj 10 liczb do tablicy a nastepnie oblicz ich sume i wypisz
|
||||
*/
|
||||
|
||||
#include <iostream>
|
||||
|
||||
using namespace std;
|
||||
|
||||
int main() {
|
||||
int suma = 0;
|
||||
int arr[10];
|
||||
|
||||
cout << "Podaj 10 liczb calkowitych: " << endl;
|
||||
|
||||
for(int i = 0; i <= 9; i++) {
|
||||
cout << "Wpisz liczbe " << i+1 <<": ";
|
||||
cin >> arr[i];
|
||||
}
|
||||
for(int i = 0; i <= 9; i++) {
|
||||
suma += arr[i];
|
||||
}
|
||||
cout << "Suma liczb to: " << suma;
|
||||
|
||||
}
|
Loading…
Add table
Reference in a new issue