Chewbacca and number

#include
using namespace std;
int main(){
int n;
cin>>n;
int a[10];
for(int i=0;i<n;i++){
cin>>a[i];
}
if(a[0]==9)
{
a[0]=a[0]-0;
}
for(int i=0;i<n;i++){

	if(a[i]>=5){
	a[i]=9-a[i];
	}

}
for(int i=0;i<n;i++){
cout<<a[i];
}}
how can i change the code so that if numbef is starting from 9 it will remain 9?

Hi @tishya_goyal
Instead of creating if condition of a[0]==0 you need to add the following if condition in your for loop

if(a[0]==9 && i==0){
continue;
}

Here is your corrected code :

okay. I got it…
Thank you so much…