Home > Back-end >  A switch statement in numerical derived using the following programming
A switch statement in numerical derived using the following programming

Time:11-17

A freshman just learning c language help!!!!!
Procedure is as follows:
#include
Int main ()
{
Int a, b, c, s, d, t, j, sum;
The scanf (" % d, % d, % d, % d ", & amp; A, & amp; B, & amp; C., & amp; S);
The scanf (" % d % d ", & amp; T, & amp; J);
Printf (" d area is: ");
The switch (s)
{
Case 1: printf (" \ n d=% d ", a + b - c); break;
Case 2: printf (" \ n d=% d ", a + c - b). break;
Case 3: printf (" \ n d=% d, b + c - a); break;
Case 4: printf (" \ n d=% d ", 0). break;
Case 5: printf (" \ n d=% d ", a c - b + a); break;
Case 6: printf (" \ n d=% d ", a - b + c); break;
Case 7: printf (" \ n d=% d, b - a + c); break;
Case 8: printf (" \ n d=% d ", a + b); break;
Case 9: printf (" \ n d=% d ", a + c); break;
Case 10: printf (" \ n d=% d, b + c); break;
Default: printf (" enter the data error! \n");
}

T=a;

If (t> B) t=b;
If (t> C) t=c;
If (t> D) t=d;
Printf (" is the smallest number: % d ", t);

if(a! J=a=t);
The else j=b;
If (c!=t);
The else j=d;
Printf (" \ n small number is: % d \ n ", j);

Sum=a + b + c + d;
If (t + j>=sum/3)
Printf (" % d \ n "is the area of d, d);
The else
Printf (" the blind to data errors \ n ");

return 0;
}



Now want to switch the d export for programming the following have to how to change? Online and other bosses answer

CodePudding user response:

CodePudding user response:

 switch (s) 
{
Case 1: printf (" \ n d=% d ", d=a + b - c); break;
Case 2: printf (" \ n d=% d ", d=a + c - b). break;
Case 3: printf (" \ n d=% d ", d=b + c - a); break;
Case 4: printf (" \ n d=% d ", d=0). break;
Case 5: printf (" \ n d=% d ", d=c - b + a); break;
Case 6: printf (" \ n d=% d ", d=a - b + c); break;
Case 7: printf (" \ n d=% d ", d=b - a + c); break;
Case 8: printf (" \ n d=% d ", d=a + b); break;
Case 9: printf (" \ n d=% d ", d=a + c); break;
Case 10: printf (" \ n d=% d ", d=b + c); break;
Default: printf (" enter the data error! \n");
}
  • Related