顺序结构与逻辑运算(7)
发布时间:2021-06-06
发布时间:2021-06-06
{ int a ,M ; scanf ("%d", &a) ; M =a>0? a:-a;
printf("abs(a)=%d",M); }
运行结果画面:
4-4 运行结果画面: #include<stdio.h> main()
{ int c, t, m; printf ("input the number of coat and trousers your want buy:\n"); scanf ("%d%d", &c, &t) ; if (c==t) if (c>=50) m=c*80; else m=c*90; else if (c>t) if (t>=50) m=t*80+ (c-t) *60; else m=t*90+(c-t)*60; else if (c>=50)m=c*80+(t-c)*45; else m=c*90+ (t-c) *45; printf ("%d", m) ;
}
4-5该程序的源程序代码(或窗口截图): #include<stdio.h> main() { float a,b,c; scanf("%f%f%f",&a,&b,&c); if(a+b<=c||a+c<=b||b+c<=a)