Need help with functions

So here are my requirements for a program

- Declare a global variable named x and initialize it to zero (easy)
- Declare a local integer variable within main named y (easy)
- From within main, prompt the user for a value for y (easy)
- Include a loop that calls a function named incx 'y' number of times (NEED HELP)
- Include a function incx to increment the value of x by one (NEED HELP)
- Print the value of x after each iteration of the loop (NEED HELP)

If someone could please help me quickly with this problem, I'd appreciate it.
How exactly are you stuck? Like do you not know how to write a function? Or just pass variables or what?
Not sure what kind of loop I need to write, and not too good at writing functions either.
Try reading the tutorial on this site, specifically the sections on functions and loops/control structures.
I understand all of them, but how do I tell it to repeat 'y' number of times? Just want to know if it's a do-while loop or something else.
Any loop will work.

For loops that are a known length you typically use a for loop.
Topic archived. No new replies allowed.