Example 1-2
Procedure 1-6
1#include <stdio.h>2#include <math.h>3 intMain ()4 {5 intN;6scanf"%d", &n);7printf"%d%d%d", n%Ten, n/Ten%Ten, n/ -);8 return 0;9}
Procedure 1-7
1#include <stdio.h>2#include <math.h>3 intMain ()4 {5 intN;6scanf"%d",&n);7printf"%d", -* (n%Ten)+Ten* (n/Ten%Ten) +n/ -);8 return 0;9}
This problem, when I'm doing it myself.
100* (n%10) +10* (n/10%10) +n/100 no parentheses, found errors, this analysis:
Priority Ah ... Bad habit.
Procedure 1-8
1#include <stdio.h>2 intMain ()3 {4 inta,b,t;5scanf"%d%d",&a,&b);6t=A;7A=b;8b=T;9printf"%d%d", A, b);Ten return 0; One}
The subject, too, was foolish, and
printf ("%d%d", A, b),%d in%a and%b result output a B
Program 1-9 variable Exchange (2)
1#include <stdio.h>2 intMain ()3 {4 intb;5scanf"%d%d",&a,&b);6a=a+b;7b=a-b;8a=a-b;9printf"%d%d", A, b);Ten return 0; One}
Program 1-10 variable Exchange (3)
1#include <stdio.h>2 intMain ()3 {4 intb;5scanf"%d%d",&a,&b);6printf"%d%d", b,a);7 return 0;8}
"Algorithmic Competition Primer Classic" Chapter 1.3