//Can Someone Explain How For-Loop Statement Work Using the following codes below?
//I'm also having difficulties in understanding how loop statement work especially the word "ctr++" and "a++; b+=5; c+=a;" bellow. Please explain how this work
#include <iostream>
using namespace std;
int main()
{
int a=1,b=1,c=1;
for (int ctr=c;ctr<=10;ctr++)
{
a++, same as a=a+1
b+=5, same as b=b+5
c+=a, same as c=c+a
Some languages don't use this type of short cut, it is a C/ (C++) thing.
Of course it doesn't make sense in the language of maths, put a=a+5 in an exam paper and you might just fail.
You can use this as a template
["code"] ["/code"]
Paste it into the box (minus the quotes) and write your code inside it.
Some formatting & indentation would not hurt either
(The part about editing a post really applies to the starting post of a thread. The format buttons and preview don't work until AFTER the thread has been created.)
Just as there are code tags you should use, there are output tags as well, as explained in the two links. You really should read the articles.