=5),
The input description
A line of an integer n (n>=5 and n
=100)
The output shows that
Every five line, also a line of less than 5
The input sample
5
The output sample
1 1 2 3 5
The code
#include
using namespace std;
Int main ()
{
Int n, I, a, [100].
A [0]=1;
A [1]=1;
Cin & gt;> n;
For (I=2; i
A [I]=a [I - 1) + a (I - 2),
}
For (I=0; I & lt; n; I++)
{
Cout & lt; If (I % 5==4)
{
Cout & lt;
}
return 0;
}
There is wrong
CodePudding user response:
There is no wrong, in fact you run itCodePudding user response:
Because this is the topic of my in a game, the final checking their score is an empty system said I was wrong, but did not say where is wrongCodePudding user response:
The last line is less a line break? Topic request of less than 5 a line, so in return 0; Need to print a newline beforeCodePudding user response:
Test, should be more than an int type, when n> 45, has turned negativeint main () {
Int n=100,=1 a1, a2=1, I, j;
Printf (" 1 1 ");
For (I=2, j=0; iIf (I % 5==0) printf (" \ n ");
A2=a1 + a2;
A1=a2 - a1;
Printf (" % d ", a2);
If (a2 & lt; 0 & amp; & J j=I==0);//record cross-border I
}
Printf (" \ n \ n % d ", j);//print why I value started crossing the line
}
CodePudding user response:
#includeusing namespace std;
Int main ()
{
Int n, I, a, [100].
A [0]=1;
a [1]=1;
Cin & gt;> n;
For ( I=2; i
){
a [I]=a [I - 1) + a (I - 2),
}
For (I=0; I & lt; n; I++)
{
Cout & lt; a [I] & lt; <"";
If ( I % 5==4 )
{
Cout & lt;
}
return 0;
}
CodePudding user response:
Bold is emptyCodePudding user response: