Hi pals I am new in C programm but I have some problems with division in my simple code
I have problems when I define h=xmax/nstep. I dont know why please help me
thx
Code:
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
# define max 60
int main ()
{
float t[max],k,h,tmax;
int j,alpha,xmax,nstep,m;
printf("xmax\n");scanf("%d",&xmax);
printf("nstep\n");scanf("%d",&nstep);
tmax=0.5;
alpha=1;
/*xmax=1;*/
/*nstep=10;*/
h=xmax/nstep;
/*k=0.5*h*h/alpha;*/
k=0.5*h*h/alpha;
m=50;
for (j=0;j<=m;j++)
{ t[j]=j*k;
printf ("%d\t%1.3f\n",j,t[j]);
}
exit(0);
}