Skip to content

Instantly share code, notes, and snippets.

@xeldrago
Last active May 4, 2020 11:51
Show Gist options
  • Save xeldrago/a7b020fd4827987935515d93359af015 to your computer and use it in GitHub Desktop.
Save xeldrago/a7b020fd4827987935515d93359af015 to your computer and use it in GitHub Desktop.
blocks tutorial
#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;
}
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?")
@kevinnls
Copy link

kevinnls commented May 3, 2020

@xeldrago you are right till line#6
after that it's all a mess

@xeldrago
Copy link
Author

xeldrago commented May 3, 2020

hows it now?

@kevinnls
Copy link

kevinnls commented May 3, 2020

better. it's a mess starting from line#14

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment