//
//  continue_example.c
//
//  This program provides an example of using
//  the continue statement
//
//  Created by Julio Bahamon on 05/29/2017.
//  Copyright © 2016 Julio Bahamon. All rights reserved.
//

#include <stdio.h>


int main()
{
   int n = 0;
   int sum = 0;
   
   int next_number = 0;
   
   
   // Use an infinite loop to continue processing
   // user input until five (5) positive numbers
   // have been processed.
   while (n < 5)
   {
      printf("Enter a positive number: ");
      scanf("%d", &next_number);
      
      
      // Skip any number less than or equal to zero
      if (next_number <= 0)
         continue;
      
      n++;
      sum += next_number;
   }
   
   printf("sum=%d\n", sum);
   
   return 0;
}