cin>>x; cnt = 0; y = x; while (x > 0) { x = x / 10; cnt++; } for (i = 1; i <= cnt; i++) { cout<<y%n<<endl; n = n * 10; }
2.a. int pari,imp,x,cif;
cin>>x; imp = 0; pari=0; while(x > 0) { cif = x % 10; if ( cif % 2 == 0) pari = 1; else imp = 1; x = x / 10; } if ( pari == 1 and imp == 1) cout<<"nu"; else cout<<"da";
b. int x, cif1, cif2;
cin>>x; while (x > 0) { cif1 = x % 10; cif2 = (x / 10) % 10; if (cif2 > cif1) { cout<<"Nu"; return 0; } x = x / 10; } cout<<"Da";
c. int x, cif, k, cnt, p;
cin>>x>>k; cnt = 0; p = 0; while (x > 0) { cif = x % 10; if (cif == k) { cnt++; p = 1; } x = x / 10; } if (p == 1) cout<<cnt; else cout<<"Cifra nu se regaseste in cadrul numarului";
2.d int i,n,cif,cn;
cin>>n; for(i=1; i<=9; i++) { cn=n; while(cn!=0) { cif=cn%10; if(cif==i) cout<<i<<" "; cn=cn/10; } } e. int n, cif, cif1, cif2, y, z, x; cin>>n; x = 0; y = 0; z = 0; while (n > 0) { cif = n % 10; x = x * 10 + cif; n=n/10; } while (x > 0) { cif1 = x % 10; z = z * 10 + cif1;
x = x / 10; if(x==0) break; cif2 = x % 10; y = y * 10 + cif2; x = x / 10;