thanks. Right now i'm working on the practice problem of converting temperatures. And I think i'm doing pretty good for a beginner.
Code:
/*
* File: main.c
* Author: zachsisk
*
* Created on September 14, 2012, 2:51 PM
*/
#include <stdio.h>
#include <stdlib.h>
#define UPPER 100
#define LOWER 0
int high = 0;
int low = 0;
int interval = 0;
int temp = 0;
void main(void){
printf("Please provide a temperature (Celcius) for the upper limit.\n");
scanf("%d", &high);
printf("You provided %dC.\n",high);
printf("Please provide a temperature (Celcius) for the lower limit.\n");
scanf("%d", &low);
printf("You provided %dC.\n", low);
printf("Please provide an interval.\n");
scanf("%d", &interval);
printf("You provided %dC.\n", interval);
temp = high;
do {
printf("%d", temp);
temp = temp - interval;
}while (temp != low - interval);
}
So far the problem i'm having is that if I provide say 95 and 90 with a interval of 2, I end up in a endless loop. Also I haven't implemented the high and low limits yet, but they are defined. Also haven't messed with conversions yet.
any suggestions?