C language to find mistakes, C language code error correction

Updated on technology 2024-04-06
5 answers
  1. Anonymous users2024-02-07

    Mistake 1: Because the three-digit number you are looking for is an integer, all variables should be int and not float.

    Mistake 2: Since o, p, and q should all be initialized after each factorial is solved, i.e., changed to 1

    So it would be nice to change it to the following:

    #include

    main()

    int a,b,c,o=1,p=1,q=1,x,y,z;

    for(a=1;a<=9;a++)

    for(b=0;b<=9;b++)

    for(c=0;c<=9;c++)

    for(x=1;x<=a;x++)

    o=x*o;

    for(y=1;y<=b;y++)

    p=y*p;

    for(z=1;z<=c;z++)

    q=z*q;

    if((100*a+10*b+c)==(o+p+q))printf("%.0f%.0f%.0f",a,b,c);

    else x=1;y=1;z=1;

    o=p=q=1;

  2. Anonymous users2024-02-06

    float a,b,c,o=1,p=1,q=1,x,y,z;(with int).

    for(a=1;a<=9;a++)

    for(b=0;b<=9;b++)affiliation)for(c=0; c<=9;c++)

    for(x=1;x<=a;x++)

    o=x*o;

    for(y=1;y<=b;y++)

    p=y*p;

    for(z=1;z<=c;z++)

    q=z*q;

    if((100*a+10*b+c)==(o+p+q))printf("%.0f%.0f%.0f",a,b,c);

    break;esle

    I must recommend it.

  3. Anonymous users2024-02-05

    #include

    int jishu(int d) is a function to find the series.

    int jishu=1;

    for(int i=1;i<=d;i++)jishu=jishu*i;

    return jishu;

    void main()

    int sanweishu=100,shuzihe=0,sum=0;

    int a=0,b=0,c=0,d=0;

    for(int i=100;i<1000;i++ three-digit number.

    a=i/100;Everybody.

    b=i/10%10;

    c=i%10;

    sum=jishu(a)+jishu(b)+jishu(c);The sum of the progressions.

    if (i==sum)

    printf("%d",i);

    It's too cumbersome for you to write like that, and the for loop is a bit much.

    I wrote you one.

  4. Anonymous users2024-02-04

    A semicolon is missing at the end of the program. In addition, the "2a" on the denominator is missing parentheses.

    #include

    #include

    int main()

    double x1,x2,a,b,c;

    printf("Knowing the equation ax 2+bx+c=0, please enter a,b,c");

    scanf("%lf%lf%lf",&a,&b,&c);

    printf("The equation is ax 2 + bx + c = 0");There are changes.

    if (b*>=0)

    x1=(-b+sqrt(b*;Changed x2=(-b-sqrt(b*; There are changes else

    x1=-b/(;There are changes.

    x2=sqrt(-(b*;There are changes to printf("The solution yields x1=%f, x2=%f",x1,x2);

    return 0;

  5. Anonymous users2024-02-03

    Answers to incorrect prompts

    1. Unexpected end of file found translated into Chinese: found the end of the abnormal file.

    Error message description: There is an exception at the end of the file of source **, and there may be abnormal characters such as Chinese characters or full-width characters.

    2. Usually there is a problem with the brace matching;

    The end of file is the eof - if the transfer control is in the C source file, if the curly braces don't match him, then it will be in the build stack"{"It can't be eliminated, and the stack is not empty when eof appears, so there is:

    unexpected end of file found”

    Summary] According to your **, the subject should be the problem of not enlarging the parentheses that led to the discovery error.

Related questions
16 answers2024-04-06

Definition of a for loop.

for(the initial value of the variable; termination of operating conditions; The initial value of the first cycle i is 0, and it runs until i=3 stops i=2, and the condition is still satisfied, and the loop body is still executed, and the step size is 1+1 each time >>>More

9 answers2024-04-06

Hey! This is a very simple function to write, Your Excellency is estimated to have just learned data structures, now learn sorting, lookup, it's easy to give me a reward of two hundred points, I'll help you write it right away. >>>More

7 answers2024-04-06

It's called the [batch] program, in fact, don't think that the program you mentioned above to deal with garbage is really powerful, it's amazing, when you have learned DOS, that program can be said to be a very simple thing; >>>More

8 answers2024-04-06

system("command");The role is to open the "Command Prompt", and later you can manually enter DOS commands. >>>More

5 answers2024-04-06

Question 1: pt1=&a;pt2=&b;pt1 and pt2 are not defined, years are defined as. >>>More