Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- void p(int &n, int c)
- {
- int d, nr=0, p=1;
- while(n)
- {
- d=n%10;
- if(d!=c)
- {
- nr=nr+(p*d);
- p=p*10;
- }
- n/=10;
- }
- n=nr;
- }
- int main()
- {
- int n, c, a[100], m, i, j ;
- cout<<"Introduceti numarul: "; cin>>n;
- cout<<"Introduceti cifra: "; cin>>c;
- p(n, c);
- cout<<n;
- cin>>m;
- for(i=0; i<m; i++)
- cin>>a[i];
- for(i=0; i<m; i++)
- {
- for(j=1; j<=9; j+=2)
- p(a[i], j);
- if(a[i]!=0)
- cout<<a[i]<<" ";
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement