MUstar

IoT C언어 0424 - 실습3

Apr 24th, 2017
28
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <stdio.h>
  2. int sum(int num);
  3. int main(void)
  4. {
  5.     sum(10);
  6.     sum(100);
  7.  
  8.     return 0;
  9. }
  10. int sum(int num)
  11. {
  12.     int pp=0,i;
  13.     for(i=0;i<num+1;i++)pp+=i;
  14.     printf("1부터 %d까지의 합은 %d입니다.\n",num,pp);
  15.     return 0;
  16. }
RAW Paste Data