The assumed x
value is the 3
calculated x
square and assigned to y
, and the sum value “y = x ∗ x”和“x ∗ x = y”
is output in the form of respectively.x
y
Input format:
No input for this question
Output format:
x=3
The result of the substitution is output in the following format :
y = x * x
x * x = y
Code:
# include <stdio.h>
# include <stdlib.h>
int main(){
int x = 3,y;
y = x * x;
printf("%d = %d * %d\n",y,x,x);
printf("%d * %d = %d\n",x,x,y);
return 0;
}
Submit screenshot:
Problem-solving ideas:
The test point of this question is to output two lines in a similar format. Pay attention to \n
the addition of a newline at the end . Use %d
a placeholder of integer type to indicate that the output number type is an integer!