Unable to find the error in my code | Half number of digits are printing

#include
using namespace std;

int Count(long int x) {
int a=0, p=x;
for (;x!=0;x=x/10) {
a++;
}
x=p;
return a;
}

int Inverse(long int x) {
int b, c, e=1;
int z=0;
long int j=1;
for (int a=1; a<=Count(x); a++) {
j=j10;
}
long int o=x%j;
for (b=1; b<=Count(x); b++) {
c=x%10;
if (c>4 && b!=Count(x)) {
c=9-c;
}
if (b==Count(x) && o!=9) {
if (c>4) {
c=9-c;
}
}
int e=1;
for (int d=1; d<=b-1; d++) {
e=e
10;
}
z=z+(e*c);
x=x/10;
}
return z;
}

int main() {
long int x;
cin >> x;
cout << Inverse(x);
return 0;
}

hi @dpspra12098, i can see that ou hae submitted the codewith 100 marks still having doubts?
if yes please share your code link by saving at https://ide.codingblocks.com/

Coding Blocks IDE

hi @dpspra12098,
refer here https://ide.codingblocks.com/s/660149 ive updated the code

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.