Home > Back-end >  The C language
The C language

Time:12-03

Anyone know where the problem is it (the runtime error)

CodePudding user response:

Fyi:
 # include & lt; stdio.h> 

Int main (void)
{
Char buf [11], * p=buf.
The scanf (" % s ", buf);
While (* p) printf (" % c ", * p++);
printf("\n");
return 0;
}

CodePudding user response:

Your 10 rows if condition unless the number of input for single digits are not to go in the example of 654321 can't go n=if you are here I want to check the length of the output Numbers to add at least a=b/10 b.

The following code for reference

 # include & lt; stdio.h> 
#include

Int main (void)
{
Long a;
While (the scanf (" % ld ", & amp; A)!=(EOF)
{
Int b [10]={0};
int i=0;
While (a & gt; 0)
{
B=a % [i++] 10;//after the split data saved to the array
A/=10;
}
For (int I=9. I & gt;=0; I -)
{
Int flag=0;//because of the array is initialized to zero, this flag to decide when is the beginning of the data because the data and data before the start of the middle may have 0
If (b [I])
Flag=1;
If (flag)//when the flag is 1, that is the data even if the current value of 0
Printf (" % d, b [I]);
}
}
}

CodePudding user response:

int i;
Char s [11];
The fgets (s, 11, stdin);
for (i=0; i<10; I++) {
If (=='\ n' s [I] | | 0==s [I]) break;
Printf (" % c ", s [I]);
}

CodePudding user response:

Int main (int arg c, char * argv [])
{
[10] long a, b, I;
While (the scanf (" % d ", & amp; B)!=(EOF)
{
I=0;
While (b!=0)
{
A [i++]=b % 10;
B/=10;
}
For (I=I - 1; I>=0; I -)
Printf (" % 2 d ", a [I]);
printf("\n");
}
system("pause");
return 0;
}

CodePudding user response:

I solved is ten digits, more than 2.1 billion

CodePudding user response:

You it's a bit too complicated, as far as possible concise code, or find a job not seek after, now that you have got the number here that directly one by one down, positive sequence words array output cycle, cycle, in addition to get more into the array variable to count at the same time, the cycle ends up another cycle output in reverse chronological order, and then determine the final output space

CodePudding user response:

This is a code is directly made a judgment before how many digits of the code change not reduced
  • Related