Sequence of number

I want to make a program that displays the square of the number from 0 to 14 using do while loop. Here i think it is almost done but something is TO BE DONE. The following program gives me series of increasing some natural numbers but i want to display square of these numbers
I use DEV c++

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#include <iostream>
#include <iomanip>
using namespace std;

int main ()
{
	int a = 0;
	do
	{
		cout << "Number: ";
		cout << a;
		cout << "\n";
		a = a + 1;
	}while(a<15);
}
Last edited on
i want to display square of these numbers

So square the number.
1
2
3
4
  int sq;
...
  sq = a * a;
  cout << "Square is: " << sq << endl;


PLEASE USE CODE TAGS (the <> formatting button) when posting code.
It makes it easier to read your code and also easier to respond to your post.
http://www.cplusplus.com/articles/jEywvCM9/
Hint: You can edit your post, highlight your code and press the <> formatting button.
Thank you so much sir!
Topic archived. No new replies allowed.