Home > Back-end >  Introduction to the C language met a thorny problem urgent to solve
Introduction to the C language met a thorny problem urgent to solve

Time:09-26

P1 is the original (pseudo code), I used to compile software is codeblocks, written code, the results of each run are smaller than the standard answer results 1 (such as input and output should be 10001, 16 should be input output 1000), is excuse me each bawcock compile environment problems or algorithm has a problem, ask the great spirit show

CodePudding user response:

Should not be used int type, involving division, use float,

CodePudding user response:

Under the VS 2015 run, no problem

CodePudding user response:

X=x/2; Int type automatically keep just in front of integer bit, may be wrong here, (float) x=(float) x/2;
  • Related