2013/10/7

程式設計1007作業

int main(void)
{
/*----16進制----*/ 
  int a,b,c,d;
  a=15,b=10;
  printf("a的16進位=%x\n",a);
  printf("b的16進位=%x\n",b);
/*----輸入輸出----*/ 
  printf("請輸入c:"); 
  scanf("%d",&c);
  printf("請輸入d:"); 
  scanf("%d",&d);
  printf("c+d=%d\n",c+d);
 
/*----加減乘除----*/
  float x,y;
  printf("請輸入x+y\n"); 
  scanf("%f+%f",&x,&y);
  printf("x+y=%0.2f\n",x+y);
  
  printf("請輸入x-y\n"); 
  scanf("%f-%f",&x,&y);
  printf("x-y=%0.2f\n",x-y);
  
  printf("請輸入x*y\n"); 
  scanf("%f*%f",&x,&y);
  printf("x*y=%0.2f\n",x*y);
  
  printf("請輸入x/y\n"); 
  scanf("%f/%f",&x,&y);
  printf("x/y=%0.2f\n",x/y);
   
  system("pause");     
}