+ 1
Please check my codes and give me suggestions
https://code.sololearn.com/cKq57i4UBliY/?ref=app https://code.sololearn.com/cKq57i4UBliY/?ref=app
2 Respostas
+ 13
Nice code 👍
My only suggestion would be to use else if like this:
if (n==1)
{ cout<<n<<"st term is "<<b<<endl;}
else if (n==2)
{ cout<<n<<"nd term is "<<b<<endl;}
else if (n==3)
{ cout<<n<<"rd term is "<<b<<endl;}
else if (n>3)
{ cout<<n<<"th term is "<<b<<endl;}
+ 13
Also, what if n is 21? Your code will say 21th but it should be 21st 😉
These codes may help:
https://code.sololearn.com/cvQ0KVguctl5/?ref=app
https://code.sololearn.com/wSM8N4d1c14Z/?ref=app