All pastes #619715 Raw Edit

Something

public text v1 · immutable
·published 2007-07-14 23:30 UTC
rendered paste body
#include <stdio.h>
int main() {
	//declare variables
	int userTemp, isFah;
	float fConv;
	char cSelection;

	printf("Please select an option form the following menu:\
			\n\n\t\tA. Fahrenheit to Centigrade\
			\n\t\tB. Centigrade to Fahrenheit\
			\n\t\tC. Exit\n\t\t\tSelect A/B/C> ");

	scanf("%c", &cSelection);

	if(cSelection == 'A' || cSelection == 'a') {
		isFah = 1;
		printf("Enter the degrees in Fahrenheit: ");
		scanf("%d", &userTemp);
		fConv = (userTemp - 32) / 1.8f;
		} else {
		if(cSelection == 'B' || cSelection == 'b') {
			isFah = 0;
			printf("Enter the degrees in Centigrade: ");
			scanf("%d", &userTemp);
			fConv = userTemp * 1.8f + 32;
		} else {
			if(cSelection == 'C' || cSelection == 'c') {
				printf("Exiting....\n\n");
				return 1;
			}
		}
	}

	printf("%d = %.0f\n", userTemp, fConv);


	return 0;
}