So here is your code: https://code.sololearn.com/cVHeZQq2lmEc/?ref=app
The problem is that you forgot to use & (Address Operator) in the scanf() function
Change line no. 9 to this:
And your code will be fine!
Note that using & Operator is must while scanning value from user in C Language, otherwise that value will freely move in the memory and will not be stored in the proper variable.