Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lesson1part1 #114

Open
wants to merge 4 commits into
base: AOsypchuk
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions 01-Git_Bash_Make/main.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#include <stdio.h>
#include <stdlib.h>
#include <time.h>

int main()
{
srand(time(NULL));
int num = 0;
printf("enter number: ");
scanf("%i", &num);

if (num < 0 || num > 9)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please, check your code style. Braces have to be on the same line

{
printf("the number is bigger than 9 or smaller then 0.\n");
exit(1);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

exit(1) means that your program crashed.

}

int comp = rand() % 10;
if (comp == num)
printf("you win!\n");
else
printf("you lose!\n");
return 0;
}