Maplewing

8/24 C: Operation

Aug 23rd, 2015
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.39 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. int main(){
  4.     /*
  5.         變數取名僅能是英文字開頭或底線開頭
  6.         (o) int a, _b, _, a1, a2;
  7.         (x) int 123, 123abc;
  8.         (x) int *, ?, !;
  9.     */
  10.     int a, b, h;
  11.     scanf("%d%d%d", &a, &b, &h);
  12.    
  13.     /*
  14.     int area;
  15.     area = ( a + b ) * h / 2;
  16.     printf("%d", area);
  17.     */
  18.     // printf可以直接輸出值,所以上式可以簡化:
  19.     printf("%d", (a+b)*h/2);
  20.    
  21.     return 0;
  22. }
Advertisement
Add Comment
Please, Sign In to add comment