# Segment woes

• 06-01-2007
astrodude15
Segment woes
Code:

```//TJ Wright 11 3 #include <stdio.h> int main () { int m, count=0,n[30]; printf("Enter the numbers, one per line"); for(m=1;m<=20;m++) { scanf("%d",&n[m]);/* input up to 20 integers, one per line, the sentinel is 0                   each of the numbers will be less than 2^30.*/ count++; if(n[m]==0)break; } for (m=1;m<=count;m++) { /* if statements asking if there is a number n such that all the integers are in the segment [n, n+32767]. If there is such a number, print the largest such n. If there is not, determine if there is a number n such that all but  1 of the integers is in the segment [n,n+32767]. If there is such a number, print the largest such. If there is no such, determine if there is such an n so that all but two of the intervals are in the interval and print the largest such. Continue this way until n is found.*/ } return 0; }```
The second comment paragraph is the purpose of the program. I can't wrap my head around the logic of it, I cant figure out how I'd apply c programming to solve the problem.
• 06-01-2007
vart
• 06-01-2007
astrodude15