Write a C program that prompts the user to enter integers (positive or negative, not including 0) from the keyboard. Your program should stop reading the numbers from the keyboard when the value 0 is entered and print the range (the difference between the maximum and the minimum) of the numbers. Note that 0 is not part of the data. Comment your program liberally.

this is what i have so far

#include <stdio.h>
#include <math.h>
#include <conio.h>

int main()

int max=0, min=0, NH, r;
    printf("Imput your test scores \n");
    printf("Enter 0 as a test score to calculate your range \n");
    scanf("%i",&NH);

    do{
        if (NH>max)
            max=NH;
        else
        {
            if (NH<min)
                min=NH;
            else
            {   printf("Enter another test score\n");}      
        }
    }while (NH!=0);
    r=max-min;
    printf("%i", r);
    getch();


    return 0;
        }




    getting an error message reading:
    error C1075 end of the file found be4 the left brace


    aka im missing a curly brace and cant igure out where.... also will this program work correctly???

your missing the starting curly brace of the main function

also will this program work correctly???

it "should" work but it doesn't match your requirements
at your loop you didn't prompt the user for input again

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.