Advertisement
Leonard_M

macroul_dar_in_functie

Mar 25th, 2020
133
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.  
  3. int char_array_to_number(){
  4.     int ch, sum = 0;
  5.  
  6.     while(true){
  7.         ch = getchar();
  8.         if(ch == '\n')
  9.             break;
  10.         sum = sum * 10 + (ch - '0');
  11.     }
  12.     return sum;
  13. }
  14.  
  15. int main()
  16. {
  17.     printf("%d", char_array_to_number());
  18.     return 0;
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement