MUstar

IoT C언어 0703 - EX_03

Jul 3rd, 2017
87
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <stdio.h>
  2.  
  3. int main(void)
  4. {
  5.     int num[10], plus = 0 ,cnt=0, ec=0, res;
  6.     while(1)
  7.     {
  8.         res = getchar();
  9.         if(res==10) break;
  10.         else
  11.         {
  12.             num[cnt] = res - 48;
  13.             cnt++;
  14.         }
  15.     }
  16.     while(2)
  17.     {
  18.         int digi=1, i=1;
  19.         if(cnt>1)
  20.         {
  21.             //digi = (int) pow(10.0, (double)cnt); //쓰기는 편한데 리눅스에서는 일반적으로 컴파일에러.
  22.             //실재 컴파일할때는 math.h을 선언후 gcc Filename.c -lm으로 커멘드을 해야 컴파일됨.
  23.             cnt--;
  24.             while(3)
  25.             {
  26.                 digi = digi * 10;
  27.                 if(i==cnt) break;
  28.                 else i++;
  29.             }
  30.             plus = digi * num[ec] + plus;
  31.             ec++;
  32.         }
  33.         else
  34.         {
  35.             plus = plus + num[ec];
  36.             break;
  37.         }
  38.     }
  39.     printf("%d\n", plus+10);
  40.    
  41.     return 0;
  42. }
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×