Home > Back-end >  If statements in VS2019 conditions useless. Seek answers.
If statements in VS2019 conditions useless. Seek answers.

Time:09-26

# include "stdio.h"
Int main ()
{
Int n, m, num;
Printf (" type in two Numbers: ");
Scanf_s (" % d, % d ", & amp; N, & amp; M);
Num=n;

If (n> M) printf (" % d \ n ", num + 1);

The else printf (" % d \ n ", n * m);
return 0;
}
Results:

Type in two Numbers: 2, 3

CodePudding user response:

All Angle comma and half Angle comma is not the same thing,

CodePudding user response:

Suggestions under the scanf_s n, add a statement printed out the value of m, then according to the results have a look at whether you want to input or input are consistent with you

CodePudding user response:

reference 1/f, zhao teacher reply:
whole Angle comma and half Angle comma is not the same thing,

You didn't see clear! All of them are half Angle commas, if there is a whole Angle comma complains,

CodePudding user response:

reference 1/f, zhao teacher reply:
whole Angle comma and half Angle comma is not the same thing,

The program also can't run, my main problem is: after I type 2 and 3 two Numbers, to judge if statements, n CodePudding user response:

reference 2 building self-confidence boy reply:
advice under scanf_s n, add a statement printed out as a result of the values of the m and see whether you want to input or input are consistent with you

The entered value is not me, but this is how to solve?

CodePudding user response:

Please judge scanf_s function return value,

CodePudding user response:

Scanf_s (" % d, % d) "two commas between % d if use English when the input to a comma in the English language

CodePudding user response:

Problems may appear in your input statement scanf_s (" % d, % d ", & amp; N, & amp; M); The comma between two points is good, with you in the black box input do not match the comma, comma has two kinds, one is English under a comma, a comma is under the Chinese, so, to ensure that this is the same two commas, had better use English by commas,
So, it is recommended that you make sure all the commas in English under the comma, in the debug,
Or, remove the comma, into space, it is the best,
The input statement: scanf_s (" % d % d ", & amp; N, & amp; M);
Then the black box, enter the input: 2 3 enter space, try!
  • Related