I gave my cell number to a stranger on the internet. Have I fallen victim to a scam?
Let's go through the process of what actually happened:
Telegram requires a cell phone number to be linked in order to create an account.
To verify that the number exists, they send out a verification code for you to enter in the app while creating the account.
This person obviously didn't want their own cell phone number to be linked to the Telegram account, which is an indication they might use it in malicious ways (terrorism, hacking, …), so:
They tried to set you up to get that code.
So to answer your questions:
Was this a scam?
I'd call it gray zone. But yes, someone did try to scam you for a Telegram verification code.
If yes, did I prevent the scam by denying this user the code?
Yes, you did well, using common sense :-)
If not, what's at risk? Is my bank account at risk, for instance? (I only gave the user my cell phone number. No name, no address, nothing else whatsoever)
That depends, how visible are you on the internet? If you have domain names registered with that number, they can find that. Facebook linked? They can likely find that depending on privacy settings. In brief, if you've linked that number to a lot of accounts, they might find those accounts and the information that's publicly in them.
If I am at risk, what do I need to do to prevent any theft of my information, passwords, money, etc.?
"At risk" is a heavy word in this situation. They just want a Telegram account; I find it likely they just moved on to one of the other 50 people they PMed while talking to you.
Just keep an eye open for "strange things" (like hacking attempts to other accounts etc.), research yourself with that phone number and see if what you can find needs changing.
It could easily have led to a scam. The request was to get access to Telegram using your phone number.
Works just like Whatsaap, when you register, you enter your number and a code is sent to your phone.
This could easily be removed by re-registering Telegram on your phone where it would repeat the process but make the other user using it unusable.
You may not use Telegram but some of your contacts may use it, and may try to contact you because they see you on the app. They may be conned in the process as they could think its you. You were clever to think twice but next time avoid giving your number so freely.
There's also the risk of targeted attacks to your smartphone by having your number (e.g. Android or iOS vulnerabilities) through MMS or SMS. But the risk is low.
If changing your number is not to burdensome, you might want to change it.
And kudos on your quick thinking!