1/* 2 * Main. c 3 * loop-01. calculate the integer segment and 4 * Created on: June 18, 2014 5 * Author: Boomkeeper 6 *** test wood has passed the *** 7 */8 9 # include <stdio. h> 10 # include <stdlib. h> 11 12 int main () 13 {14 int a, B, sum; 15 scanf ("% I", & a, & B ); 16 17 if (a> B) 18 exit (0); 19 20 {21 int I = 0, count = 0; 22 for (I = a; I <= B; I ++) 23 {24 printf ("% * I", 5, I); 25 count ++; 26 if (count = 5 & I! = B) // if the number is 5 and not the last one, wrap 27 {28 printf ("\ n"); 29 count = 0; 30} 31 sum + = I; 32} 33} 34 printf ("\ nSum = % I \ n", sum); 35 return 0; 36}
This is a tough issue. It's not difficult, but it's wrong! The result is the following... please give us some advice. It's been a long time since there were spaces on the screen...
Link: http://pat.zju.edu.cn/contests/basic-programming/%E5%BE%AA%E7%8E%AF-01