#include
using namespace std;
int main() {
char a[50];
cin>>a;
int i=0;
if(a[i]==‘9’)
{i++;}
for(;a[i]!=’\0’;i++)
{
int dig =a[i]-‘0’;
if(dig>4)
dig=9-dig;
a[i]=dig+‘0’;
}
cout<<a;
return 0;
}
will using cin>>a work???
since we are inputting the no without spaces wont it b stored in a[0]?
Chewacca and number doubt
@Shreya-Gupta-2383169445069382
hello shreya,
pls refer this article-> https://www.programiz.com/cpp-programming/strings
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.