Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <fstream>///fisiere
- using namespace std;
- ifstream fin("nrcurat.in");///de intrare
- ofstream fout("nrcurat.out");///de iesire
- int main()
- {
- int n,c,ogl, cnt,i,nr,cn;
- while(fin>>n) ///se citeste numar cu numar
- {
- ogl=0; cnt=0; nr=0;
- cn=n;
- while(n!=0)
- {
- c=n%10;
- n=n/10;
- cnt++; ///numara cate cifre
- ogl=ogl*10+c;///oglindit
- }
- ///cream numarul cu 9999..9
- for(i=1;i<=cnt;i++)
- nr=nr*10+9;
- if(ogl==nr-cn) fout<<1<<" ";
- else fout<<0<<" ";
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment