Advertisement
yanni_yagami

Untitled

Jul 18th, 2020
864
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.29 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <string.h>
  3.  
  4. int main()
  5. {
  6.   int sum = 0, average;
  7.   char str[256];
  8.   scanf("%s", str);
  9.  
  10.   for(int i = 0; i < strlen(str); i++)
  11.   {
  12.     sum += str[i];
  13.   }
  14.  
  15.   average = sum / strlen(str);
  16.  
  17.   printf("average : %d : %c\n", average, average);
  18.  
  19.   return 0;
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement