Hello guys. I have a problem in my code.... Because i'm a noob.
Code:
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
int main()
{
int n = 0, k = 0, combinations, n_total= 0, loop_count;
printf("Enter in a interger\n");
scanf("%d", &n);
getchek:
if(n > 10)
{
printf("ERROR: Enter a number between 1-10\n");
scanf("%d", &n);
goto getchek;
}
else {
printf("Enter another interger: \n");
scanf("%d", &k);}
getchek2:
if(n < k)
{
printf("ERROR: Enter a number between 1 and %d\n", n);
scanf("%d", &k);
goto getchek2;
} else
{
loop_count=n;
n_total=n;
while(loop_count=0)
{
n_total=n_total * n;
n_total--;
loop_count--;
}
printf("N = %d", n_total);
}
system("pause");
return 0;
}
My problem seems to be that n is staying at 5 even with my aritmetic.
Any hints would be helpful.