Skip to content

Instantly share code, notes, and snippets.

@oyakodon
Forked from dicenull/01-1-hello_world.cpp
Last active August 5, 2018 08:19
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 oyakodon/eda1b04be9ca4ea82e4427fd8749ff89 to your computer and use it in GitHub Desktop.
Save oyakodon/eda1b04be9ca4ea82e4427fd8749ff89 to your computer and use it in GitHub Desktop.
#include <iostream>
int main()
{
std::cout << "Hello, world!" << std::endl;
return 0;
}
#include <iostream>
using namespace std;
int main()
{
cout << "Hello, world!" << endl;
return 0;
}
#include <iostream>
using namespcae std;
int main(int argc, char **argv)
{
cout << "Hello, world!" << endl;
return 0;
}
#include <iostream>
using namespace std;
int main()
{
int n;
n = 3;
n = n + 2;
cout << n << endl;
return 0;
}
#include <iostream>
using namespace std;
int main()
{
int n = 2;
if(n % 2 == 0)
{
cout << n << "は偶数" << endl;
}
else
{
cout << n << "は奇数" << endl;
}
return 0;
}
#include <iostream>
using namespace std;
int main()
{
int number = 13;
if(number > 10)
cout << number << "は10より大きい" << endl;
else if(number < 10)
cout << number << "は10よりちいさい" << endl;
else
cout << number << "は10に等しい" << endl;
return 0;
}
#include <iostream>
using namespace std;
int main()
{
for(int i = 0;i < 10;i++)
{
cout << i << endl;
}
return 0;
}
#include <iostream>
using namespace std;
int main()
{
for(int i = 0;i < 100;i++)
{
if(i % 15 == 0)
cout << "FizzBuzz" << endl;
else if(i % 5 == 0)
cout << "Buzz" << endl;
else if(i % 3 == 0)
cout << "Fizz" << endl;
else
cout << i << endl;
}
return 0;
}
#include <iostream>
using namespace std;
int main()
{
int n;
cin >> n;
n = n * 2;
cout << n << endl;
return 0;
}
#include <iostream>
using namespace std;
int main()
{
int a[4];
a[0] = 334;
a[1] = 3 + 3 + 4; // 10
a[2] = 3 * 3 * 4; // 36
a[3] = 226;
cout << a[0] << "," << a[2] << endl;
for ( int i = 0; i < 4; i++ )
{
cout << a[i] << endl;
}
return 0;
}
#include <iostream>
using namespace std;
int main()
{
int a[10];
for ( int i = 0; i < 10; i++ )
{
cin >> a[i];
}
cout << "偶数: ";
for ( int i = 0; i < 10; i++ )
{
if ( a[i] % 2 == 0 )
{
cout << a[i] << " ";
}
}
cout << endl;
cout << "奇数: ";
for ( int i = 0; i < 10; i++ )
{
if ( a[i] % 2 != 0 )
{
cout << a[i] << " ";
}
}
cout << endl;
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment