#include <stdio.h>
#include <io.h>
#include <stdlib.h>
#include <math.h>



int main(void)
{
  FILE* fin;
  FILE* fout; 
      
    if((fout=fopen("OUT1.txt","w")) == NULL) {           /*test=file name, r = read mode, which reads from the file*/
    printf("Cannot open file.\n");
    exit(1);
       }
       
    if((fin=fopen("DATA1.TXT","r")) == NULL) {           /*test=file name, r = read mode, which reads from the file*/
    printf("Cannot open file.\n");
    exit(1);
       }
       
    int a;
    a=0;
    for(a=0;a<=4;a++){
                      double degree, power,distance, pi,radian, cosine, sine;
   
    pi=3.14159;
   
                      fscanf(fin ,"%lf", &degree);
                      fscanf(fin, "%lf", &power);
                      
                      radian=(pi*degree)/180;
                      
                      cosine=cos(radian);
                      sine=sin(radian);
                      
                      distance=power*cosine*((2*power*sine)/9.81);
                      
                      fprintf(fout,"%.0f\n", distance);
                      }
     
     
     fclose(fin);  
   fclose(fout); /*u need to close the file after opening it*/
  return 0;
}

