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.
 
 
 

25 lines
484 B

#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include "berechnung.h"
char* convert(int input){
char* result = malloc(5*sizeof(char*));
sprintf(result,"%d\n", input);
if (input % 15 == 0)
strcpy(result,"fizzbuzz\n");
else if (input % 5 == 0)
strcpy(result,"buzz\n");
else if (input % 3 == 0)
strcpy(result,"fizz\n");
return result;
}
int gcd(int a, int b) {
if (b == 0) return a;
return gcd(b, a % b);
}