Funktions-Prototypen

This commit is contained in:
Stephan Richter
2018-02-09 14:01:11 +01:00
parent b923a51e0e
commit 362602c36a

View File

@@ -1,16 +1,29 @@
#include <stdio.h> #include<stdio.h>
float sum(float a, float b){ // Funktions-Prototypen
return a+b; float eingabeZahl();
} float multipliziere(float zahl1, float zahl2);
void ausgabeErgebnis(float ergebnis);
int main(){ // Hauptprogramm
int main() {
float a,b; // Rechenvorgang
printf("erste Zahl eingeben:"); ausgabeErgebnis(multipliziere(eingabeZahl(), eingabeZahl()));
scanf("%f",&a);
printf("erste Zahl eingeben:");
scanf("%f",&b);
printf("die Summe aus %f und %f ist %.3f",a,b,sum(a,b));
return 0; return 0;
} }
// Funktionen
float eingabeZahl() {
float eingabe;
printf("\nEingabe Zahl: ");
scanf("%f", &eingabe);
return eingabe;
}
float multipliziere(float zahl1, float zahl2) {
return (zahl1 * zahl2);
}
void ausgabeErgebnis(float ergebnis) {
printf("\nErgebnis: %f\n", ergebnis);
}