Vorlage für Automatisiertes Testen mit der Programmiersprache C
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

24 lines
484 B

1 year ago
  1. #include <stdio.h>
  2. #include <string.h>
  3. #include <stdlib.h>
  4. #include "berechnung.h"
  5. char* convert(int input){
  6. char* result = malloc(5*sizeof(char*));
  7. sprintf(result,"%d\n", input);
  8. if (input % 15 == 0)
  9. strcpy(result,"fizzbuzz\n");
  10. else if (input % 5 == 0)
  11. strcpy(result,"buzz\n");
  12. else if (input % 3 == 0)
  13. strcpy(result,"fizz\n");
  14. return result;
  15. }
  16. int gcd(int a, int b) {
  17. if (b == 0) return a;
  18. return gcd(b, a % b);
  19. }