码迷,mamicode.com
首页 > 其他好文 > 详细

补交第九次作业

时间:2016-11-29 09:54:19      阅读:159      评论:0      收藏:0      [点我收藏+]

标签:printf   计算   sum   max   diff   float   void   个数   print   

拆分    整数与小数
#include <stdio.h> void sum_diff(float op1,float op2,float *psum , float* pdiff) { *psum = op1+op2; *pdiff = op1-op2; } int main(void) { float f1=11.1, f2=1.5, sum, diff; sum_diff(f1, f2, &sum, &diff); printf("sum=%g, diff=%g\n", sum, diff); }
最大值
#include<stdio.h> void findmax( int *px, int *py, int *pmax ) { *pmax = *px; if(*py > *pmax) *pmax = *py; } int main(void) { int max,x,y; scanf("%d%d",&x,&y); findmax(&x,&y,&max); printf("max:%d\n",max); }
两个数和与差的计算
#include <stdio.h> void sum_diff(float op1,float op2,float *psum , float* pdiff) { *psum = op1+op2; *pdiff = op1-op2; } int main(void) { float f1=11.1, f2=1.5, sum, diff; sum_diff(f1, f2, &sum, &diff); printf("sum=%g, diff=%g\n", sum, diff); }

 

补交第九次作业

标签:printf   计算   sum   max   diff   float   void   个数   print   

原文地址:http://www.cnblogs.com/kanghui/p/6112209.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!