All pastes #619672 Raw Edit

Someone

public text v1 · immutable
·published 2007-07-14 22:50 UTC
rendered paste body
#include <stdio.h>
int count = 0;
int main() {
	//declare variables
	int isFah, userTemp;
	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("%s", &cSelection);

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

	printf("%d degrees %s is %.0f degrees centigrade\n", userTemp, isFah ? "Fahrenheit" : "Centigrade", fConv);

	return 0;
}