c条件表达式与选择结构.pptVIP

  • 2
  • 0
  • 约5.84千字
  • 约 31页
  • 2016-12-21 发布于河南
  • 举报
#includestdio.h void main() { int a,b,max; printf(\n input two numbers: ); scanf(%d%d,a,b); max=a; if (maxb) max=b; printf(max=%d,max); } 例:求两个整数的较大值。 max=ab? a: b; #includestdio.h void main( ) { int x,y; scanf(%d,x); if (x0) y=-x; else y= x; printf(x=%-6d,y=%d,x,y); } 例:求任意整数的绝对值。 y= x=0? x: -x; #include stdio.h void main() { int a=5,b=8,z; z= (a++b++) ? a++ : b++; printf(a=%d,b=%d,z=%d\n,a,b,z); } #includestdio.h void main( ) { int x, leap; scanf(%d,x); leap=0; if (x%4==0 x%100!=0 || x

您可能关注的文档

文档评论(0)

1亿VIP精品文档

相关文档