Documents
Resources
Learning Center
Upload
Plans & pricing Sign in
Sign Out

28

VIEWS: 40 PAGES: 1

									#include<iostream.h> #include<conio.h> #include<fstream.h> void main() { clrscr(); fstream g("cifre.out",ios::out); int a[10],nrcifre=0,b[20],cifra,z=0,p=0; int i,n,j,nr,k,x; cout<<"n="; cin>>n; x=n; while(n){a[++nrcifre]=n%10; n=n/10;} for(i=1;i<=nrcifre;i++){nr=0 ; for(j=1;j<=nrcifre;j++) if(a[i]==a[j]) nr=nr+1; if(nr==1) {g<<a[i]; b[++p]=a[i];} } for(i=1;i<=nrcifre;i++){ for(j=i+1;j<=nrcifre;j++) if(a[i]==a[j]){g<<a[i]; b[++p]=a[i]; } }cout<<endl; for(i=1;i<=p;i++)cout<<b[i]<<" "; cout<<endl; for(i=1;i<=p;i++){z=0; k=x; while(k){ cifra=k%10; if(cifra==b[i]) z++; k=k/10;} cout<<"frecventa cifrelor "<<z<<endl;} getch(); }


								
To top