Last active
March 16, 2016 11:18
-
-
Save rogerioagjr/3a272eb8f6b50aa54858 to your computer and use it in GitHub Desktop.
Quadrado de Pares
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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