daily pastebin goal
6%
SHARE
TWEET

Untitled

a guest Apr 16th, 2018 56 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include<iostream.h>
  2. #include<conio.h>
  3. int nr(long int &n,int c)
  4. {   int k=0;
  5.     while(n>0)
  6.     {   if(n%10==c)k++;
  7.     }
  8.     n=k;
  9. }
  10. void main()
  11. {       clrscr();
  12.     int i;
  13.     long int n,nr;
  14.     int k=0;
  15.     cout<<"n=";cin>>n;
  16.     nr=n;
  17.     for(i=0;i<=9;i++)
  18.     {       n=nr;
  19.         nr(n,i);
  20.         if(n==1)k++;
  21.     }
  22.     cout<<k;
  23.     getch();
  24. }
RAW Paste Data
Top