Home > Back-end >  Where is the wrong ('; ︵; `)
Where is the wrong ('; ︵; `)

Time:10-13

Write a program that seeks a + b | |, including a, b for two integers,,

Input format:

Have multiple sets of test data, processing to the end-of-file, each group of test data on the same line input two integers a, b,

The output format:

Each set of output values of a + b | |



# include
Int main ()
{int a, b, c;
The scanf (" % d, % d ", & amp; A, & amp; B);
C=a + abs (b);
Printf (" % d ", c);
; return 0;
}

CodePudding user response:

A.c: In the function 'main' :
A.c: if: warning: implicit declaration of the function 'abs' [- Wimplicit - function - declaration]
C=a + abs (b);
^ ~ ~
A.c: 4:5: warning: ignoring the return value of the scanf, declared with the attribute warn_unused_result [- Wunused - the result]
The scanf (" % d, % d ", & amp; A, & amp; B);
^ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~

CodePudding user response:

Abs is math. H header file contains

CodePudding user response:

Fun
reference 2 floor response:
abs is math. H header file contains

Or wrong ah??

CodePudding user response:

Please copy topic request detailed point, the output format?

CodePudding user response:

reference 4 floor MorgenChen response:
please copy topic request detailed points, the output format?

Input format:

Have multiple sets of test data, processing to the end-of-file, each group of test data on the same line input two integers a, b,

The output format:

Each set of output values of a + b | |

CodePudding user response:

reference 4 floor MorgenChen response:
please copy topic request detailed points, the output format?

At this point, and the
Input the sample:

Given a set of input here, for example:

23-150

The output sample:

Here is given the corresponding output, for example:

173

CodePudding user response:

Subject requirements have multiple sets of test data, processing to the end-of-file! Don't know how to do

CodePudding user response:

 # include 
#include

Int main ()
{
int a,b,c;

The scanf (" % d, % d ", & amp; A, & amp; B);

C=a + abs (b);
Printf (" % d ", c);
return 0;
}


For your reference ~

Need to introduce & lt; Stdlib. H> The header file

CodePudding user response:

 # include 
#include

Int main ()
{
int a,b,c;

//the scanf (" % d, % d ", & amp; A, & amp; B);//input, 50-50
The scanf (" % d % d ", & amp; A, & amp; B);//input 23-150

C=a + abs (b);
Printf (" % d ", c);
return 0;
}

For your reference ~

CodePudding user response:

Or wrong ah??

CodePudding user response:

refer to the eighth floor confident boy reply:
 # include 
#include

Int main ()
{
int a,b,c;

The scanf (" % d, % d ", & amp; A, & amp; B);

C=a + abs (b);
Printf (" % d ", c);
return 0;
}


For your reference ~

Need to introduce & lt; Stdlib. H> The header file

Or wrong

CodePudding user response:

11 references weixin_46371549 response:
Quote: refer to the eighth floor confident boy reply:
 # include 
#include

Int main ()
{
int a,b,c;

The scanf (" % d, % d ", & amp; A, & amp; B);

C=a + abs (b);
Printf (" % d ", c);
return 0;
}


For your reference ~

Need to introduce & lt; Stdlib. H> The header file

Or the wrong


I've compiled under Linux operation, no problem, you said that mistake is compilation problems, or run problem?

CodePudding user response:

reference 12 building self-confidence boy reply:
Quote: reference 11 floor weixin_46371549 response:

The
Quote: 8 reference building self-confidence boy reply:
 # include 
#include

Int main ()
{
int a,b,c;

The scanf (" % d, % d ", & amp; A, & amp; B);

C=a + abs (b);
Printf (" % d ", c);
return 0;
}


For your reference ~

Need to introduce & lt; Stdlib. H> The header file

Or the wrong


I've compiled under Linux operation, no problem, you said that mistake is compilation problems, or run problem?

Wrong answer, displayed on the PTA,

CodePudding user response:

Commas to space the scanf (" % d, % d ", & amp; A, & amp; B);

CodePudding user response:

On the 14th floor m0_46108109
reference response:
commas into space the scanf (" % d, % d ", & amp; A, & amp; B);

So OK, thank you

# include
# include
# include
Int main ()
{int a, b, c;
While (the scanf (" % d % d ", & amp; A, & amp; B)!=(EOF);
C=a + abs (b);
{
Printf (" % d ", c);
}
return 0;
}

CodePudding user response:

nullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnull
  • Related