ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1001. Reverse Root

i have submitted this five times always i get crash(access violation) error
Posted by santhoshvenkat 15 Jul 2007 19:20
#include<stdio.h>
#include<math.h>
double a[90];
int main(void)
{
  double ch;
  long int j=0;
  while(scanf("%lf",&ch)!=EOF && j<=90)
  a[j++]=sqrt(ch);
  for(j-=1;j>=0;--j)
  printf("%.4lf\n",a[j]);
  return 0;
}

Edited by author 16.07.2007 20:18

Edited by author 16.07.2007 20:18

Edited by author 16.07.2007 20:18
Re: what is wrong in this code .
Posted by elmariachi1414 (TNU) 16 Jul 2007 15:39
1. You haven't allocate memory for array a like this:
float a[N];
2. You don't need to do this:
if(ch == ' ')
continue;
scanf() will automaticaly read only numbers.

Good luck