Last active
May 4, 2020 11:51
-
-
Save xeldrago/a7b020fd4827987935515d93359af015 to your computer and use it in GitHub Desktop.
blocks tutorial
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> | |
void sayhello(){ | |
printf("Hello World"); | |
} | |
int main(){ | |
int num; | |
char* number; | |
do{ | |
printf("\njust say some number: "); | |
scanf("%d",&num); | |
if(num==0){ | |
number = "zero"; | |
} | |
else if(num%2==1){ | |
number = "odd"; | |
} | |
else if(num%2==0){ | |
number="even"; | |
} | |
else { | |
number = "impossible. don't worry. you'll never get here."; | |
} | |
switch(number[0]){ | |
case 'e': printf("you have entered an even number");break; | |
case 'o': printf("you have entered an odd number");break; | |
case 'z': printf("you have entered zero. so let's just call it even.");break; | |
default: printf("what kind of sorcery is this?");} | |
} | |
while(1); | |
return 0; | |
} |
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
def sayhello(): | |
print("HelloWorld") | |
while True: | |
num = int(input("\njust say some number: ")) | |
if(num==0): | |
number = "zero" | |
elif(num%2==1): | |
number = "odd" | |
elif(num%2==0): | |
number="even" | |
else: | |
number = "impossible. don't worry. you'll never get here." | |
if(number[0] == 'e'): | |
print("you have entered an even number") | |
elif(number[0] == 'o'): | |
print("you have entered an odd number") | |
elif(number[0] == 'z'): | |
print("you have entered zero. so let's just call it even.") | |
else: | |
print("what kind of sorcery is this?") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
better. it's a mess starting from line#14