title: C while loop to calculate interest
body: <p>I want my program to use a while loop and perform this interest calculation.  I would like the loop to end if -1 is entered as the value of principal.</p>
  
  <p>I feel like I'm missing something very vital and that it's not allowing my program to run accordingly.</p>
  
  <p>The program will also sometimes crash and other times run, but never calculate the interest.</p>
  
  <pre><code>float interest;
  float rate;
  float principal;
  int days;
  
  
  while(principal !=-1)
  {
          interest = principal * rate * days / 365;
  
  
      printf("%s""Enter loan principal (-1 to end):");
      scanf("%f", &amp;principal);
  
      printf("%s""Enter interest rate:");
      scanf("%f", &amp;rate);
  
      printf("%s""Enter term of the loan in days:");
      scanf("%d", &amp;days);
  
      printf("The interest charge is $%.2f", interest);
  }
  </code></pre>