Home > Back-end >  Just learning C language, beg you bosses help me have a look at this a few programs where wrong!
Just learning C language, beg you bosses help me have a look at this a few programs where wrong!

Time:09-29

The first:


The second:

#include
#include
Int main ()
{
Float x, y;
The scanf (" % f ", & amp; X);
If (x<0)
Printf (" no definition \ n ");
Else if (x>=40)
Printf (" no definition \ n ");
The else
{
Switch ((int) x/10)
{
Case is 0, y=sin (x);
break;
Case 1: y=cos (x);
break;
Case 2: y=exp (x) - 1;
break;
Case 3: y=log (x);
break;
}
Printf (" % 2 lf \ n ", y);
}
return 0;
}



The third:

Fourth:

CodePudding user response:

The second
The log (x + 1)
The third
Term=a should write behind the scanf, for there is a semicolon, I=0 or i<=n.
The fourth
Sum=0, n=n/10

CodePudding user response:

//printf (" % 2 lf \ n ", y); 
Printf (" % 2 f \ n ", y);

Y definition is a float, so the output should use % % f instead of lf

CodePudding user response:

Ok, thank you!!!!!!

CodePudding user response:

reference 1st floor qq_45883336 response:

the secondThe log (x + 1)
The third
Term=a should write behind the scanf, for there is a semicolon, I=0 or i<=n.
The fourth
Sum=0, n=n/10

Ok thank you!!!!!!!!!!
  • Related