# Great the work is done

Dev Skill archived problems can be discussed here.

### Great the work is done

This is my code for the problem Great the work is done. i tested this code with uDebug and it shows output accepted. But still it shows wrong answer in DevSkill site. What is the problem can anyone tell me please.

Code: Select all
`#include <stdio.h>#include <math.h>struct data {    int hoursTake;    int totalMebers;};int main() {         struct data input;        scanf("%d %d", &input.hoursTake, &input.totalMebers);        int sum = 0;        if (input.hoursTake<=100 && input.totalMebers<=100) {                for (int i = 0; i<input.totalMebers; i++) {            int individualH;            scanf("%d",&individualH);            if (individualH<=24) {                sum += individualH;            }        }            }        double ans = (double)input.hoursTake/sum;        int finalAns = (int)ceil(ans);        if (finalAns>1) {         printf("Project will finish within %d days.\n", finalAns);    }    else{         printf("Project will finish within %d day.\n", finalAns);    }    return 0;}`

Posts: 28
Joined: Sat Aug 06, 2016 11:02 pm

### Re: Great the work is done

This problem has multiple test cases. Recheck the sample I/O provided on devskill.

Posts: 33
Joined: Thu Jul 28, 2016 8:14 am
Location: Amar Ekushey Hall, University of Dhaka

### Re: Great the work is done

yes i saw it has multiple testCase. but how many testCases they have not mentioned. how how many testCase should i take ?

Posts: 28
Joined: Sat Aug 06, 2016 11:02 pm

### Re: Great the work is done

There is a concept called end of file or in short EOF. This helps you to determine when the input ends.

For example the code below:

Code: Select all
`#include <stdio.h>int main(){    int c;    while ((c = getchar()) != EOF)    {        /*        ** Do something with c, such as check against '\n'        ** and increment a line counter.        */    }}`

Please do some search in google with terms : How to use EOF to run through a text file in C

you may learn how to do this.

Posts: 118
Joined: Tue Feb 02, 2016 10:24 pm

### Re: Great the work is done

thank you i got it now

Posts: 28
Joined: Sat Aug 06, 2016 11:02 pm

Who is online
Users browsing this forum: No registered users and 1 guest