Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- int main(){
- int choice;
- float faktorKj, faktorKcal, ergebnis, input;
- title();
- printf("In welche Einheit wollen Sie umrechnen?\n");
- printf("[1] kJ in kcal\n");
- printf("[2] kcal in kJ\n");
- printf("[3] Programm beenden\n");
- printf("Auswahl: ");
- scanf("%i", &choice);
- fflush(stdin);
- faktorKj = 4.184;
- faktorKcal = 0.239006;
- if ( choice == 1 ) {
- title();
- printf("Bitte KiloJoule eingeben: ");
- scanf("%f", &input);
- fflush(stdin);
- printf("\n\n");
- ergebnis = input * faktorKcal;
- printf("%.3fkJ sind %.3fkcal\n", input, ergebnis);
- system("pause");
- }
- if ( choice == 2 ) {
- title();
- printf("Bitte Kilokalorien eingeben: ");
- scanf("%f", &input);
- fflush(stdin);
- printf("\n\n");
- ergebnis = input * faktorKj;
- printf("%.3fkcal sind %.3fkJ\n", input, ergebnis);
- system("pause");
- }
- if ( choice == 3 ) {
- system("exit");
- }
- }
- int title(){
- system("cls");
- system("color 0a");
- system("title Kj zu kcal Rechner");
- printf("####################################\n");
- printf(" Kj zu kcal Rechner\n");
- printf("####################################\n");
- printf("\n");
- }
Advertisement
Add Comment
Please, Sign In to add comment