@ -264,3 +264,18 @@ int binomial_coefficient(int n, int k) {
}
return result;
int ByOne(int n) {
int orig, count = 0;
orig = n;
while (n > 0) {
n = n >> 1 << 1;
if (orig - n == 1)
count++;
orig = n >> 1;
n = orig;
orig = count;
n = count;
printf("Das Ergebnis lautet: %d", n);
return count;
@ -43,5 +43,6 @@ double Vangle(float x1, float x2, float x3, float z1, float z2, float z3);
float vPunkt(float x1, float x2, float x3, float z1, float z2, float z3, float p1, float p2, float p3);
double probability_from_tree(double successful_outcomes, double total_outcomes, double branches);
int binomial_coefficient(int n, int k);
int ByOne(int n);
#endif
@ -7,6 +7,7 @@
int main()
{
double a,b,c,d,h,x1,s1,x2,x3,z1,z2,z3,p1,p2,p3,m,x,y,z;
int n;
a = getValue('a');
b = getValue('b');
h = getValue('h');
@ -204,4 +205,7 @@ int main()
b = getValue('b')
binomial_coefficient(a, b);
n = getValue('X');
ByOne(n);