Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int WYSTAPIENIA (int n, int c);
- int main()
- {
- int n,c;
- cout << "Podaj liczbe" << endl;
- cin>>n;
- cout <<"Podaj cyfre ktorej ilosc w liczbie chcesz sprawdzic"<<endl;
- cin>>c;
- cout<< WYSTAPIENIA (n,c);
- return 0;
- }
- int WYSTAPIENIA (int n, int c){
- int a;
- a=0;
- do{
- if(n%10==c){
- a++;}
- n=n/10;
- }
- while(n>0);
- return a;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement