Hello there!
I am new to programming and I am having trouble with a homework assignment. I was hoping someone could point me in the right direction.
I need to use three of the loop commands, while, for and do. I am supposed to ask the user for an integer n and use the loop commands to display all odd integers from 0 to n. Then I need to display these values calling on each loop command.
I have no idea how to start!
This is what I have.. Don't make fun!
Code:
#include <iostream>
int odd(int n)
{
for (int i = 1 : i <= n ; std::cout << i << std::endl, i+=2 )
{ }
return 0;
}
int main()
{
std::cout <<" Please enter n: ";
std::cin >> n;
I don't know where to start or if I'm even heading the right direction. I don't expect you to do this for me but I need help!
Thanks!
Sam