Sum of n numbers till encounters -999 using C program will check the number is equal to -999. If it is same, then it will break the statement. Otherwise it will sum the given numbers and executes the condition until the condition is unsatisfied.
[Read: Career Guidance for all] & [Aptitude Q&A free download]
C PROGRAM:
//Header files
# include <stdio.h>
# include <conio.h>
void main()
{
	//Program variables
	int num,sum=0;
	clrscr();//Function used to clear previous output
	do //Unconditional statement
	{
	printf("Enter the number(-999 to exit) : "); //Display function
		scanf("%d",&num); //Getting input function
		if(num!= -999)
			sum += num;
		else
			break;
	}while(num != -999);
	printf("sum = %d",sum);
	getch();
}