Skip to content

Instantly share code, notes, and snippets.

@felladrin
Created February 10, 2012 21:09
Show Gist options
  • Save felladrin/1792891 to your computer and use it in GitHub Desktop.
Save felladrin/1792891 to your computer and use it in GitHub Desktop.
Quadrado dos N primeiros números não-negativos
#include <iostream>
using namespace std;
int main()
{
int n;
do
{
cout << "Digite um número inteiro positivo: ";
cin >> n;
}
while (n < 0);
for (int i = 1; i < n+1; i++)
cout << "O quadrado do número " << i << " é " << i * i << endl;
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment