So I'm currently in my first year in university studying electrical engineering. I'm taking a intro to C course, and I'll say it now, I'm not sure if I'm going to be able to pass the exam. Even with the help of my father I find programming extremely hard. If you give me a code to trace and figure out what's being printed, if it will have any errors, I'm pretty good at doing that. However, when it comes to writing a program from scratch, this is my real struggle. Even if I'm given a set of instructions on how to do it, I still won't be able to do it. For example, I'm doing a past exam that asks me to prompt the user to enter integers until the user enters 0. Spent 3 hours thinking about it to no ado. At this point the program will take all the user inputted values and take an average.
So this is how I thought it out:
- I need to use a for loop or a while loop to prompt the user to enter an integer.
- I need to find some way to store the variables the user enters.
- If the user enters 0, I'll use an if statement to calculate the average, print it out, and break.
So I'm stuck on finding some way to store all the variables and this has stumped me for hours.