Commit 3df8ed61 by sameis

Upload New File

parent e259f180
Showing with 72 additions and 0 deletions
#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;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment