Simple Program to demonstrate sentinel operation in C
Posted by mark123
Last Updated: September 20, 2012
  1975

#include<stdio.h>

#include<stdlib.h>
// Simple Program to demonstrate the sentinel operation.
int main()
{
 int cusno;
 char first[13];
 char last[15];

   printf("Please enter a customer no to begin:(Press -1 to terminate \n");
   scanf("%d",&cusno);//testing condition or primer.
   while(cusno!= -1) //while loop to test condition
   {
   printf("Please enter the first name of customer:");
   scanf("%s",first);
   printf("Please enter the last name of customer:");
   scanf("%s",last);
    printf("Please enter a customer no to begin:(Press -1 to terminate \n");
   scanf("%d",&cusno); //second statement to provide the escape condition to the loop.
   }
   if(cusno== -1)
   {
   printf("Program exited successfully\n");
   system("pause");
   exit(0);
   }

return 0 ;

}
   
  
 
 
   

 
 
gud..