Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
sameis
/
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
3df8ed61
authored
Oct 16, 2017
by
sameis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Upload New File
parent
e259f180
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
72 additions
and
0 deletions
Kodutöö/PR1Kodutöö1_Meister.txt
Kodutöö/PR1Kodutöö1_Meister.txt
0 → 100644
View file @
3df8ed61
#include <stdio.h>
#include <stdio.h>
#include <math.h>
int a, ym, h;
float y[15], x[15];
void input()
{
printf("Sisesta algv22rtus: ");
scanf("%d", &a);
printf("Sisesta samm: ");
scanf("%d", &h);
printf("Sisesta piirv22rtus: ");
scanf("%d", &ym);
}
void process(float x[15], float y[15])
{
int i=0;
while(i<15)
{
x[i]=a+(i*h);
if (x[i]!=0)
{
y[i]=(2+x[i])*(x[i]+(1/x[i]))/(x[i]*x[i]+(1/(1+(x[i]*x[i]))));
}
i++;
}
}
void output(float x[15], float y[15])
{
int i=0;
printf("%10s| Y\n", "X ");
while (i<15)
{
printf("%10f|",x[i]);
if (y[i]<=ym)
{
if (x[i]!=0) //Kui x!=0, siis prindib vastused
{
printf("%10f \n",y[i]);
}
else
{
printf(" V22rtus puudub!!! \n");
}
}
else
{
printf(" Yletab piirv22rtust!!! \n"); //Y on suurem kui YM
}
i++;
}
}
main()
{
printf("Leiame y = (2+x)*(x+(1/x)) / (x*x+(1/(1+(x*x)))) v22rtuse!\n\n");
int i=0;
input();
process(x,y);
output(x,y);
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