Skip to content

Instantly share code, notes, and snippets.

@ampulhetadosaber
Last active May 20, 2020 13:31
Show Gist options
  • Save ampulhetadosaber/67c49ffac2eb434ef81a8cc97f00f578 to your computer and use it in GitHub Desktop.
Save ampulhetadosaber/67c49ffac2eb434ef81a8cc97f00f578 to your computer and use it in GitHub Desktop.
#include <iostream>
using namespace std;
int main()
{
int x;
cin >> x; // leio o valor de x
if(( x % 2 ) == 0) // se ele for divisível por 2
{
cout << 2*x << "\n"; // imprimo o dobro do número
}
else // senão
{
cout << x << "\n"; // imprimo o próprio número
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment