#include <stdio.h>
#include <math.h>
#include <stdlib.h>
void main()
{
int func (double x[], int n);
int N,i,t,n,m;
double f;
printf("input N\n");
scanf(" %d",&N);
printf("f=%lf\n",f);
printf("t=%lf\n",t);
double PI= 4.0*atan(1.0);
for(i=1; i<=N; i+2);
{
for(t=0; t<=n; t++);
{
srand(time(NULL));
double f = rand();
x[t]=(4/PI)*((1/i)*sin(2*i*PI*f*t));
x[t]>-10||x<10;
}
}
}
Here is My code to such a task
https://imagizer.imageshack.us/v2/1244x699q90/673/af9sg9.jpg[
^]
Could you tell me where am I wrong for Part 1?
It is in the formula that it icreases by 2, so how should I store it?
Now I have something like this
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
#include "time.h"
int func(double x[], int n);
int main()
{
int func (double x[], int n);
int N,i,t,n,m;
double f,x[1000];
printf("input N\n");
scanf(" %d",&N);
double PI= 4.0*atan(1.0);
for(i=1; i<=N; i+2)
{
for(t=0; t<=n; t++)
{
srand(time(NULL));
double f = rand();
x[t]=(4/PI)*((1/i)*sin(2*i*PI*f*t));
if(x[t]>-10||x<10)
printf("%lf\n",x[t]);
}
}
return 0;
}
So I think I have come up with part 1 solution, but I am still figuring out part 2
I have this so far, can you point me where I am wrong?
#include <stdio.h>
#include <math.h>
#include "winbgi2.h"
#include "time.h"
#include <stdlib.h>
int main()
{ int N ;
printf("input N\n");
scanf(" %d",&N);
graphics(1000,200);
int n = 10000;
double f = 0.01;
double PI= 4.0*atan(1.0);
for(int t=0; t<=n; t++)
{
double y;
y=(4/PI)*sin(2*PI*f*t);
int p;
if (y>0)
p=50;
else
p=70;
circle(t,p,1);
}
wait();
for(int i=1; i<=N; i+2)
{
for(int t=0; t<=n; t++)
{
double x;
x=(4/PI)*((1/i)*sin(2*i*PI*f*t));
circle(t,x,1);
}
}
return 0;
}