Pelles C forum

Pelles C => General discussions => Topic started by: Ali on September 30, 2004, 02:58:18 am

Title: Need Help Please
Post by: Ali on September 30, 2004, 02:58:18 am
I wrote this program it's ment to calculate the suqar root of number form 1-10 and store it in the array but i can'nt seem to make it work.

#include <stdio.h>
#include <math.h>

#define SIZE 10
int main()
{
   double x[SIZE];
   //double r;
   int i;
   for (i=1; i<=SIZE; i++)
   {
      x[] = sqrt (x) ;
      printf("%lf\n",x[SIZE] );
   }
   return 0;
}
Title: Need Help Please
Post by: Ngan Lo on September 30, 2004, 06:53:56 am
Code: [Select]
int main(void)
{
double x[SIZE];
//double r;
int i;
for (i=0; i<SIZE; i++)
{
x[i] = sqrt (i+1) ;
printf("%lf\n",x[i] );
}

return 0;
}