Last active
April 21, 2017 13:24
-
-
Save bykalim/3bf003ba30ee19951021e10454a813c1 to your computer and use it in GitHub Desktop.
CA Programming Lab2 Extra: at RUPP
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* | |
* Written by By Kalim | |
* 21/Apr/2017 | |
* | |
*/ | |
#include <stdio.h> | |
#include <string.h> | |
int main(int argc, char const *argv[]) { | |
int trigger = 0; | |
char choice1[5]; | |
char choice2[5]; | |
float f; | |
float c; | |
float tem; | |
start: | |
scanf("%s", choice1); | |
scanf("%s", choice2); | |
scanf("%f", &tem); | |
if ((strcmp(choice1,"cel")==0) && (strcmp(choice2,"fahr")==0)){ | |
printf(">> %.2f Fahrenheit\n",(tem*9)/5+32); | |
goto start; | |
} | |
else if ((strcmp(choice1,"fahr")==0) && (strcmp(choice2,"cel")==0)){ | |
printf(">> %.2f Celcius\n",(tem-32)*5/9); | |
goto start; | |
} | |
else { | |
printf("-------------Invalid Input--------------\n"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment