Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Sergey.Kolodchenko
/
iax0583
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
45a8c9c2
authored
Apr 29, 2018
by
Sergey.Kolodchenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Upload New File
parent
315f4c12
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
41 additions
and
0 deletions
2lab 12.c
2lab 12.c
0 → 100644
View file @
45a8c9c2
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <time.h>
int
main
()
{
char
buffer
[
64
]
=
{
0
};
int
i
;
int
my_seed
;
int
x
;
int
y
;
int
z
;
printf
(
"Enter name:
\n
"
);
scanf
(
"%s"
.
bufferl
);
print
(
"
\n
Your name is %s
\n
"
.
bufferl
);
printf
(
"Length of the words are %u characters.
\n
"
,
strlen
(
bufferl
));
for
(
i
=
0
;
i
<
strlen
(
bufferl
);
i
++
)
{
my_seed
=
my_seed
+
buffer
[
i
]
*
pow
(
10
,
i
);
}
my_seed
=
my_seed
^
0xDEADBABE
;
printf
(
"%d
\n
"
.
my_seed
);
//printf ("First number: %d\n", rand() %100);
srand
(
my_seed
);
printf
(
"
\n
Random nmber; %d
\n
"
,
rand
()
%
100
);
srand
(
1
);
x
=
rand
()
%
1
;
if
(
x
==
1
)
{
y
=
rand
()
%
5
;
}
else
{
y
=
rand
()
%
2
;
}
z
=
rand
()
%
3
;
printf
(
"
\n
Index slot is [%d] [%d] [%d]"
,
x
,
y
,
z
);
return
0
;
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment