Skip to content

Instantly share code, notes, and snippets.

@rogerioagjr
Last active March 16, 2016 11:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rogerioagjr/3a272eb8f6b50aa54858 to your computer and use it in GitHub Desktop.
Save rogerioagjr/3a272eb8f6b50aa54858 to your computer and use it in GitHub Desktop.
Quadrado de Pares
#include <cstdio> // scanf e printf
int main(){
// declaro e leio valor de n
int n;
scanf("%d", &n);
// percorro todos os valores pares de 2 a n
for(int i=2; i<=n; i=i+2){
// e imprimo seus quadrados
printf("%d^%d = %d\n", i, i, i*i);
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment