I suggest that you start with something like this:
Code:
#include <iostream>
int main()
{
int n = 5;
// ... loop and print the integers from 0 to 5 inclusive ...
}
So, this program will print the simplified output:
then you change to n = 6, recompile and run the program to check.
After that, work on a program that would, depending on the value of n, print something like:
After you have formulated and implemented an algorithm that does that, combine what you learnt from the two programs to implement a program with output like:
Code:
0
1==0
2==1==0
3==2==1==0
4==3==2==1==0
5==4==3==2==1==0
When you are done with this part, then finally add in code to satisfy these requirements:
Write a program that accepts a positive integer. (...) Use do while to allow the user to continue or not.