-
-
Save redgosho/31e607fd35fe93a6eedd8c800f45b5db to your computer and use it in GitHub Desktop.
偶数奇数を見分けるだけのプログラム(整数のみ)
This file contains hidden or 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 <stdio.h> | |
#include <stdlib.h> | |
int main() | |
{ | |
char word[200]; | |
char c; | |
int brake; | |
int a; | |
brake = 0; | |
a = 0; | |
while(brake != 1145114){ | |
if(c != '\n'){ | |
c = getchar(); | |
word[a] = c; | |
a++; | |
} | |
else{ | |
brake = 1145114; | |
} | |
} | |
int num; | |
num = 0; | |
num = atoi(word); | |
printf("%d\n",num); | |
int amari; | |
amari = num % 2; | |
if(amari == 0){ | |
printf("偶数\n"); | |
} | |
else{ | |
printf("奇数\n"); | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment