Advertisement
nontawat1996

plus1 v2

Oct 1st, 2013
47
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.60 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4. int main()
  5. {
  6.     int N,in,Sum=0,P,rP,dP=0;
  7.     scanf("%d",&N);
  8.     while(1)
  9.     {
  10.         scanf("%d",&in);
  11.         if(in>=0) Sum+=in;
  12.         else break;
  13.     }
  14.     P=(Sum*10000)/N;
  15.     rP=P%100;
  16.     dP+=(P/1000)*10;
  17.     P%=100;
  18.     dP+=(P/10);
  19.     printf("%d\n",N);
  20.     printf("%d\n",Sum);
  21.     printf("%d.",dP);
  22.  
  23.     if(rP<10) printf("0");
  24.     printf("%d\n",rP);
  25.     P/=100;
  26.     if(P>=80) printf("4");
  27.     else if(P>=70) printf("3");
  28.     else if(P>=60) printf("2");
  29.     else if(P>=50) printf("1");
  30.     else printf("0");
  31.  
  32.     return 0;
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement