there is a problm in this programme

but i dont know what is it

question

Write a C-Program that does the following

• Read integer numbers from a file inp.dat

• Calculate the sum, average, and multiplicand of even numbers and store the result and the even numbers in output file out1.dat

• Calculate the sum, average, and multiplicand of odd numbers and stored the result and the odd numbers in output file out2.dat

Code:#include <stdio.h> #include <math.h> #include<stdlib.h> main () { FILE *inp,*outp1,*outp2; int num, even_sum, odd_sum, even_product, odd_product, count_even=0, count_odd=0; double even_average, odd_average; inp=fopen("C:\\inp.dat","r"); outp1=fopen("C:\\out1.txt","w"); outp2=fopen("C:\\out2.txt","w"); if(inp==NULL) { printf("cannot open file"); exit(1); } even_sum=0; even_product=1; odd_sum=0; odd_product=1; for(fscanf(inp,"%d",num); num!=EOF; fscanf(inp, "%d", num)); { if(num%2 ==0) { fprintf(outp1, "even=%d\n", num); even_sum +=num; even_product *=num; count_even++; } else { fprintf(outp2, "odd=%d\n", num); odd_sum +=num; odd_product *=num ; count_odd++; } } even_average=(even_sum)/(count_even); odd_average=(odd_sum)/(count_odd); fprintf(outp1,"the sum=%d\n the product=%d\nand the average=lf",even_sum,even_product,even_average); fprintf(outp2,"the sum=%d\n the product=%d\n and the average=%lf",odd_sum,odd_product,odd_average); }