Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
glkink
/
C-programming
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
b98bc339
authored
Jan 23, 2022
by
glkink
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add new file
parent
a6664e2f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
47 additions
and
0 deletions
ül2
ül2
0 → 100644
View file @
b98bc339
#include <stdio.h>
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
int maxJaMin(int *massiiv, int pikkus, int miinimum, int maksimum)
{
int loogika = 0;
for (int i = 0; i < pikkus; ++i)
{
if(massiiv[i] <= maksimum && massiiv[i] >= miinimum)
{
loogika++;
}
printf("%d ", massiiv[i]);
}
return loogika;
}
int main()
{
srand(time(NULL));
int pikkus, miinimum, maksimum, loogika;
printf("Maksimum väärtused: \n");
scanf("%d",&maksimum);
printf("Miinimum väärtused: \n");
scanf("%d",&miinimum);
printf("Massiivi pikkus: \n");
scanf("%d",&pikkus);
int massiiv[pikkus];
for (int i = 0; i < pikkus; ++i)
{
massiiv[i] = rand() % (maksimum + miinimum);
}
loogika = maxJaMin(massiiv, pikkus, miinimum, maksimum);
printf("need jäävad võtmevaartuste vahele masiivis %d \n",loogika);
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