Advertisement
hamaXD

basic function

Oct 20th, 2016
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.29 KB | None | 0 0
  1. //function
  2.  
  3. #include<stdio.h>
  4.  
  5. void get1(int x);
  6. int main()
  7. {
  8.     int y;
  9.     while(1){
  10.    
  11.     scanf("%d",&y);
  12.     get1(y);
  13. }
  14. }
  15. void get1(int x)
  16. {
  17.     int i;
  18.     if(x>0){
  19.         for(i=1;i<=x;i++){
  20.             printf("+");
  21.         }
  22.     }  
  23.     else if(x<0){
  24.         for(i=0;i>x;i--){
  25.             printf("-");
  26.         }
  27.     }  
  28.     printf("\n");
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement