Home > Back-end >  Where is wrong, this?? ('; ︵; `)
Where is wrong, this?? ('; ︵; `)

Time:10-13

Subject to code program, calculate and output and two positive integers, difference, product and quotient and remainder, subject to ensure all input and output in the range of the integer

Input format:

Input in A row in the given two positive integers A and B,

The output format:

In 5 lines in accordance with the format "operator B=results" sequence output and, difference, product and quotient and remainder,

# include
Int main ()
{int a, b;
The scanf (" % d % d ", & amp; A, & amp; B);
Printf (" % d % d=% d \ n ", a, b, a + b);
Printf (" % d, % d=% d \ n ", a, b, a - b).
Printf (" % d % d *=% d \ n ", a, b, a * b);
Printf (" % d/d=% d \ % n ", a, b, a/b);
Printf (" % d % % d=% d \ n ", a, b, a % b);
return 0;
}

CodePudding user response:

A.c: In the function 'main' :
A.c: 10:17: warning: conversion lacks, the type at the end of the format/- Wformat=
Printf (" % d % % d=% d \ n ", a, b, a % b);
^
A.c: 5-2: 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:

Printf (" % d % % % d=% d \ n ", a, b, a % b);

CodePudding user response:

refer to the second floor m0_46108109 response:
printf (" % d % % % d=% d \ n ", a, b, a % b);

Why are the two % %

CodePudding user response:

May only write one or use escape characters, compiler implementation up trouble, I don't know why,

CodePudding user response:

Don't know why is % % baidu

CodePudding user response:

 # include 
Int main ()
{
Int a, b;
The scanf (" % d % d ", & amp; A, & amp; B);

Printf (" % d % d=% d \ n ", a, b, a + b);
Printf (" % d, % d=% d \ n ", a, b, a - b).
Printf (" % d % d *=% d \ n ", a, b, a * b);
If (b!=0)
Printf (" % d/d=% d \ % n ", a, b, a/b);
Printf (" % d % % % d=% d \ n ", a, b, a % b);

return 0;
}


For your reference ~

Note b is zero, not another % is a special character, so use % %

CodePudding user response:

reference 6 building self-confidence boy reply:
 # include 
Int main ()
{
Int a, b;
The scanf (" % d % d ", & amp; A, & amp; B);

Printf (" % d % d=% d \ n ", a, b, a + b);
Printf (" % d, % d=% d \ n ", a, b, a - b).
Printf (" % d % d *=% d \ n ", a, b, a * b);
If (b!=0)
Printf (" % d/d=% d \ % n ", a, b, a/b);
Printf (" % d % % % d=% d \ n ", a, b, a % b);

return 0;
}


For your reference ~

Note b is zero, not another % is special characters, so use % %

Ok, thank you??
  • Related