Home > Back-end >  C language to write
C language to write

Time:10-03

Adopting the for loop output is the sum of digits 5 three digits,

CodePudding user response:

Method a, the most stupid
From 100 to 999 cycle and then took out each bit is added up to 5

Method 2
For (x=1; x<=5; X++)
For (y=0; Y<=5 - x; Y++)
Printf (" % d \ n ", x * 100 + y + 10 + 5 - x, y);

CodePudding user response:

Printf (" % d \ n ", x * 100 + y * 10 + 5 - x, y);
  • Related