MUstar

IoT C언어 0626 - ex_01

Jun 26th, 2017
63
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <stdio.h>
  2.  
  3. void print_graph(int *ps, int size);
  4.  
  5. int main(void)
  6. {
  7.     int score[5] = {72,88,95,64,100};
  8.    
  9.     for(int i= 0;i<sizeof(score)/4;i++)
  10.     {
  11.         print_graph(&score[i],score[i]/5);
  12.     }
  13.  
  14.     return 0;
  15. }
  16.  
  17. void print_graph(int *ps, int size)
  18. {
  19.     if(*ps<10)printf("(  %d) ",*ps);
  20.     else if(*ps<100)printf("( %d) ",*ps);
  21.     else printf("(%d) ",*ps);
  22.     for(int i=0;i<size;i++)
  23.     {
  24.         printf("*");
  25.     }
  26.     printf("\n");
  27. }
RAW Paste Data