Code:
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
//The function names
int main(void)
{
int x, y;
srand(time(NULL));
x = rand() % 100;
//Code #1
if(x % 10 != 0)
{
if (x % 2 == 0){
printf("YOU GOT THE NUMBER %d AND ITS A EVEN NUMBER!\n", x);
fflush(stdout);
}
else
printf("YOU GOT THE NUMBER %d AND ITS A ODD NUMBER!\n", x);
fflush(stdout);
}
if (x % 10 == 0)
{
if(x == 0)
printf("You got the number %d, so we can't start!", x);
else
printf("YOU GOT THE NUMBER %d AND ITS AN EVEN NUMBER, BUT YOU ARE THE WEAKEST LINK, GOOD-BYE!\n", x);
return (EXIT_SUCCESS);
}
y = x;
x = rand() % 100;
//Code #2
while(x % 10 != 0)
{
if (x % 2 == 0 && x > y)
{
printf("The NUMBER is %d (even) which is > %d also the previous integer.\n", x, y);
fflush(stdout);
}
if (x % 2 != 0 && x > y)
{
printf("The NUMBER is %d (odd) which is > %d also the previous integer.\n", x, y);
fflush(stdout);
}
if (x % 2 == 0 && x < y)
{
printf("The NUMBER is %d (even) which is < %d also the previous integer.\n", x, y);
fflush(stdout);
}
if (x % 2 != 0 && x < y)
{
printf("The NUMBER is %d (odd) which is < %d also the previous integer.\n", x, y);
fflush(stdout);
}
y = x;
x = rand() % 100;
}
if (x == 0)
printf("YOU GOT THE NUMBER %d, so we can't start :'(\n", x);
else
printf("YOU GOT THE NUMBER %d AND ITS AN EVEN NUMBER, BUT YOU ARE THE WEAKEST LINK, GOOD-BYE!\n", x);
return (EXIT_SUCCESS);
}
This is the code I made last night with the code, thank you guys for helping me solve this problem.