Quick actions

cmd+k|ctrl+k

Navigation

Languages

lab6_146

Snippet info

Language

Cpp

Visibility

public

Author

maloy-

Created

2018-12-11T11:03:46Z

Updated

2018-12-11T11:03:46Z

#include <iostream>
using namespace std;

int main() {
    const int n = 50 ; 
    int a[n] , b[n];
    for (size_t i = 0 ; i < n ; i++){
        a[i] = rand() % 100 ; 
        cout << a[i] << "  ";
    }
    
    cout << "Введите число k" << endl ; 
    int k ; 
    cin >> k ;
    int x = 0 ; 
    for (size_t i = 0 ; i < n ; i++){
        if (a[i] % 10 == k){
            b[x] = a[i];
            x++;
        }
    }
    for (size_t i = 0 ; i < x ; i++){
        cout << b[i] << "  ";
    }
    
    return 0;
}
INFO