Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int WYSTAPIENIA(int l, int c)
- {
- int i=0;
- int a=0;
- for(;l>1;i++){
- if(l%10==c){
- a++;
- }
- l=l/10;
- }
- return a;
- }
- int main()
- {
- int liczba;
- int cyfra;
- cout << "Podaj liczbe: ";
- cin>>liczba;
- cout<<"Podaj cyfre: ";
- cin>>cyfra;
- cout<<"Cyfra "<<cyfra<<" pojawia sie w liczbie "<<liczba<<" ";
- cout<<WYSTAPIENIA(liczba,cyfra)<<" razy";
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement