Current location - Training Enrollment Network - Mathematics courses - Mathematical program If
Mathematical program If
# Contains? & ltstdio.h & gt

int? Master ()

{

int? x,y;

Printf ("Please enter the value of x:");

scanf("%d ",& ampx);

If (x==0)

y = x = 0;

Or what? if(x & gt; 0)

y = x = 1;

Or what? What if? (x & lt0)

y = x =- 1;

printf("x=%d,y=%d ",x,y);

Return? 0;

}

// -

//? Here, I point out your mistakes, which can be of great help to you.

//First of all, if statements are used continuously, and only the successful one is executed. If there is more, it will not be executed again.

//Second, you don't need to print f(" x =% d, y =% d ",x, y) every time; At the end. I modified the above. I also found your (X.

//-If you add several range identifiers to your program, you can {} This is the second program.

# Contains? & ltstdio.h & gt

int? Master ()

{

int? x,y;

Printf ("Please enter the value of x:");

scanf("%d ",& ampx);

If (x==0)

{

y = x = 0;

printf("x=%d,y=%d ",x,y);

}

Or what? if(x & gt; 0)

{

y = x = 1;

printf("x=%d,y=%d ",x,y);

}

Or what? What if? (x & lt0)

{

y = x =- 1;

printf("x=%d,y=%d ",x,y);

}

Return? 0;

}

//Oh, = is depreciation, = = is judgment. Look at your judgment =, hehe, wrong.

//The meaning and result of the two programs are the same, but the writing is different. You can compare with yours and fully understand these two programs. Then prove that you do.