HELP

guys look at my code, something is not right? I have no time to fix it. I have lots work to do. Please FIx it for me. I beg you:
Im using dev c.

#include <stdio.h>
#include <stdlib.h>
int bit(void);
int hey;
main()
{
printf("Hello,Good day! \n");
bit();
printf("\n\n Do you wish to try it again?(y/n): ");
scanf("%d",&hey);
if(hey == 'y');
{
bit();
}
int bit;
int num, fact = 1;
printf("Input a non-negative integer here: ");
scanf("%d", &num);

for(int i=1; i<=num; i++)
{
fact = fact * i;
}

printf("The factorial of %d is %d\n", num, fact);
system("pause");
}
}
else (hey == 'n');
{
return 0;
}



Both your code and your post have problems, but since you made it obvious you don't care about explanations and suggestions, I'll just give you the "fixed" code.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#include <stdio.h>
#include <stdlib.h>

//int bit(void);

int main(void)
{
    char hey;

    printf("Hello,Good day! \n");
    //bit();

    do
    {
        //int bit;
        int num, fact = 1;

        printf("Input a non-negative integer here: ");
        scanf("%d", &num);

        for(int i=1; i <= num; i++)
        {
            fact = fact * i;
        }

        printf("The factorial of %d is %d\n", num, fact);
        printf("\n\n Do you wish to try it again?(y/n): ");
        fflush(stdin); // clear the newline: this method isn't something to rely on
        scanf("%c", &hey);
    }
    while (hey == 'y');

    return 0;
}

Thank you very much :)
Topic archived. No new replies allowed.