I need help figuring out how to make this for loop print 25 times no matter what. The problem is to: generate a table of conversions from Celsius to Rankin, allow the user to enter starting temp and increment. Print 25 lines. Use a for loop in your solution.
Code:
#include<stdio.h>
int main()
{
//Variable declarations
double ra;
double c,inc;
//getting the values from the user
printf ("Enter the starting temperature in degrees Celsius: ");
scanf("%lf", &c);
printf("Enter the increment: ");
scanf("%lf", &inc);
printf ("\nCelsius\t\t Rankin\n"); //printing the label for the table
printf ("-----------------------------\n");
//Print celsius an rakin and calculate rankin in a loop
for(c=c;c<=25*inc;c+=inc)
{
ra = (1.8*c)+32+459.67; //converting celsius to rankin
printf ("%7.3f\t\t %7.3f\n",c,ra); //printing 1 row of values
}
//Exit program
return 0;
}