llgd.net
当前位置:首页 >> 编写程序读入3个整数 >>

编写程序读入3个整数

1、#includeint main() 2、{ int a,b,c; scanf("%d%d%d",&a,&b,&c); 3、 int sum = a+b+c; 4、 printf("和: %d",sum); 5、printf("平均值:%f",sum/3.0); 6、return 0 讲解:1、先定义四个整形。2、一个浮点型保存平均值。3、然后在控制台等待...

输入三个数你可以这样 Scanner in=new Scanner(System.in); int a=in.nextInt(); Scanner in=new Scanner(System.in); int b=in.nextInt(); Scanner in=new Scanner(System.in); int c=in.nextInt(); 然后对三个数进行比较。 int tmp=0; if(a

VC程序如下: #include main() { double a,b,c,ave; printf("请输入三个双精度数:\n\n"); scanf("%f,%f,%f,&a,&b,&c); printf("三数的平均数为:\n"); ave=(a+b+c)/3.0; printf("%5.1f",ave); }

#include #include int main(){int a=0,b=0,c=0;float ave =0;scanf("%d%d%d",&a,&b,&c);ave = (float)((a+b+c)/(3*1.0));printf("Average of %d、%d and %d is %.2f\n",a,b,c,ave);}22 33 44Average of 22、33 and 44 is 33.00Press any key to...

代码如下: #includeint main(){ int a , b , c; scanf("%d %d %d" , &a , &b , &c); //输入三个数 空格分开 if(a

#include int main (){ int a, b, c; printf("请输入三个任意整数:\n"); scanf("%d%d%d", &a, &b, &c); if(b > a){ a = b; if(a < c) a = c; } else{ if(a < c) a = c; } printf("最大的整数是:%d\n", a); return 0; }

楼上程序错了,得不了正确的结果!少了一行代码! 应; #include void main() { int a,b,c,min; printf("请任意输入三个整数:") scanf("%d%d%d",&a,&b,&c); if(a>=b)min=b; else min=a; if(min>c)min=c; printf("%d\n",min); }

#include main() { int a,b,c,z; printf("please input a,b,c:\n"); scanf("%d,%d,%d",&a,&b,&c); if(a

1、只有3个数,可以用判断语句直接调整数的顺序,不用去写排序程序。 2、vb示例: Private Sub Command1_Click() Dim a As Integer, b As Integer, c As Integer, t As Integer a = Val(InputBox("input a:", , 5)) b = Val(InputBox("input b:"...

代码1. // 输入3个数,要求按从小到大顺序输出 #include int main() { int a,b,c,t; printf("请输入三个数:"); scanf("%d%d%d",&a,&b,&c); if(a > b) { t = a; a = b; b = t; } if(a > c) { t = a; a = c; c = t; } if(b > c) { t = b; b = c; ...

网站首页 | 网站地图
All rights reserved Powered by www.llgd.net
copyright ©right 2010-2021。
内容来自网络,如有侵犯请联系客服。zhit325@qq.com