okay so i want to make a formula that start with (n + 2) but every multiple of 3 the formula decreased by 1 for example :
if n = 0, then value is 2 formula is n+2
1, 3
2, 4
3, 4 formula become n+1
4, 5
5, 6
6, 6 formula become n
... 9, 8 formula become n-1 and so on
there's no real reason using if beside i only learn if and haven't learn other command yet
what i mean is that i want a user to input an integer into the formula i made but the formula decrease/changed if the user input an integer within a multiple of 3
the starting formula is (n+2) therefore if the user input 0,1,2 the formula stay the same but if the user input 3 the formula changed to (n+1) for 3,4,5 and if 6 the formula changed to (n+0) for 6,7,8 and so on. The result printed is only 1 number not a list of numbers.
Simply enough - input/3. Store this value into an int to get rid of the decimal. This number will be the number you want to subtract from the 2 being added to n. So -
1 2 3 4 5 6 7 8 9
int userinput();
// Ask for it and assign it here
int subtract();
subtract = userinput/3;
int finalNumber();
finalNumber = 2 - subtract;
Made the code a bit longer so you can see everything happening. finalNumber will have the number to either add or subtract with N to use for your loop.