Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cstdlib>
- #include <ctime>
- using namespace std;
- int main(){
- int w,k,a=1,b=100,ktory,suma=0;
- cout << "Podaj ilosc wierszy: ";
- cin >> w;
- cout << "Podaj ilosc kolumn: ";
- cin >> k;
- int tab[w][k];
- srand(time(NULL));
- for(int i=0; i<w; i++){
- for(int j=0; j<k; j++){
- tab[i][j]=a+rand()%(b-a+1);
- }
- }
- cout << "Podaj wiersz do sumowania: ";
- cin >> ktory;
- while(w<ktory){
- cout << "Wartośc za duża. Podaj nowa ";
- cin >> ktory;
- }
- for(int d=0; d<k; d++){
- suma=suma+tab[ktory][d];
- }
- cout << "Suma w wierszu " <<"["<<ktory<<"]" << " wynosi: " <<"["<<suma<<"]" << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement