Pattern number ladder

output is same as given then why it is showing wrong answer.

hi @aggarwalriya878_9fa040293dc28647 take value of n from system
cin>>n;