Home > Software engineering >  C born rabbit the classical solution, program for output but why not?
C born rabbit the classical solution, program for output but why not?

Time:10-19

Raw rabbit, a pair of rabbits, three months will give birth to a pair of, ask how many rabbits after a few months, this is the program, why when I input after months, no output console program disappeared?
#include
Int main ()
{
Int m=3, the sum=0, I, a, b;
The scanf (" % d ", & amp; M);
If (m<3)
{
Printf (" 2 ");
}
The else
{
A=2, b=2;
For (I=3; i{
Sum=a + b;
a=b;
B=sum;
}
printf("%d",sum);
}
return 0;


}

CodePudding user response:

Run over the console application is closed, you can return 0; Add a line in front of the getchar (); You can stop,
Or use the system (" pause "); Need to include the header file # include

CodePudding user response:

No cycle

No interrupt

1/f, method can be

CodePudding user response:

Add # include & lt; Conio. H>

Before the return add

getch();

CodePudding user response:

99% now code farmers should not enter in the CMD window CD command sets the current directory to the program directory, enter the program name to run the program!
  • Related