Jump to content

[C++]Generarea patratelor perfecte pana la un numar n


AIM Katzuno Valoare
 Share

Recommended Posts

#include <iostream>

using namespace std;

int main()
{
	int i, n;
	cout << "Pana la cat doriti generarea?: ";
	cin >> n;

	for (i = 1; i <= n; i++) 
		if (i * i <= n)
			cout << i * i << "\t";
	
	return 0;

}

 

Edited by shanker'
asezare in pagina / adaugarea algoritmului in <code>
Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
 Share

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.