Advertisement
cd62131

Sum

Feb 23rd, 2014
260
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.30 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. int main(void) {
  4.   char *buf = (char *) malloc(BUFSIZ);
  5.   char *p = buf;
  6.   int i, sum = 0;
  7.   do {
  8.     for (i = 0; i < 8; i++) { scanf("%c", p); sum += *p; p++; }
  9.     getchar();
  10.   } while (sum % 10 != 0);
  11.   p = '\0'; printf("%s\n", buf);
  12.   return 0;
  13. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement