Home > Back-end >  Novice c language to solve, novice poorer, no points
Novice c language to solve, novice poorer, no points

Time:01-16

 # include & lt; stdio.h> 
Int main ()
{
Char ch, c, s [2]; \
Int m, n, l, I, a;
Float x, y, z;
Printf (" Enter the operation of your choice: ");
Printf (" \ na. Add s.s ubtract \ n ");
Printf (" m. multiply d.d ivide \ n ");
Printf (" q.q uit \ n ");
Scanf_s (" % s ", & amp; S, 2);
Ch=s [0];
The rewind (stdin);
While (ch! )
='q'{
The switch (ch)
{
Case 'a' :
{printf (" Enter the first number: \ n ");
While (scanf_s (" % f ", & amp; X)!
=1){
Char c=0;
While (c=getchar ()! )
='\ n'Putchar (c);
Printf (" is not a number, the correct number to the as - 1, 3 or 25, both please enter again ");
}
For (I=10, m=0, l=1; L!!!=0; I *=10)
{
A=(int) (x * I);
L=a % 10;
If (l!=0)
m++;

}
Printf (" Enter the second number: \ n ");
While (scanf_s (" % f ", & amp; Y)!
=1){
C=0;
While (c=getchar ()! )
='\ n'Putchar (c);
Printf (" is not a number, the correct number to the as - 1, 3 or 25, both please enter again ");
}
For (I=10, n=0, l=1; L!!!=0; I *=10)
{
A=(int) (x * I);
L=a % 10;
If (l!=0)
n++;

}
Z=x + y;
If (m==0 & amp; & N==0)
Printf (" %. * f + %. * f=%. * f \ n ", m, x, m, y, m, z);
The else
{
If (m & gt; N)

Printf (" %. * f + %. * f=%. * f \ n ", m, x, m, y, m, z);
The else
Printf (" %. * f + %. * f=%. * f \ n ", n, x, n, y, n, z);
}


break;
}
In case the 's' :
{printf (" Enter the first number: \ n ");
While (scanf_s (" % f ", & amp; X)!
=1){
Char c=0;
While (c=getchar ()! )
='\ n'Putchar (c);
Printf (" is not a number, the correct number to the as - 1, 3 or 25, both please enter again ");
}
For (I=10, m=0, l=1; L!!!=0; I *=10)
{
A=(int) (x * I);
L=a % 10;
If (l!=0)
m++;

}
Printf (" Enter the second number: \ n ");
While (scanf_s (" % f ", & amp; Y)!
=1){
Char c=0;
While (c=getchar ()! )
='\ n'Putchar (c);
Printf (" is not a number, the correct number to the as - 1, 3 or 25, both please enter again ");
}
For (I=10, n=0, l=1; L!!!=0; I *=10)
{
A=(int) (x * I);
L=a % 10;
If (l!=0)
n++;

}
Z=x - y;
If (m==0 & amp; & N==0)
Printf (" %. * f - %. * f=%. * f \ n ", 0, x, 0, y, 0, z);
The else
{
If (m & gt; N)

Printf (" %. * f - %. * f=%. * f \ n ", m, x, m, y, m, z);
The else
Printf (" %. * f - %. * f=%. * f \ n ", n, x, n, y, n, z);
}

break;
}
Case 'm:
{printf (" Enter the first number: \ n ");
While (scanf_s (" % f ", & amp; X)!
=1){
Char c=0;
While (c=getchar ()! )
='\ n'Putchar (c);
Printf (" is not a number, the correct number to the as - 1, 3 or 25, both please enter again ");
}
For (I=10, m=0, l=1; L!!!=0; I *=10)
{
A=(int) (x * I);
L=a % 10;
If (l!=0)
m++;

}
Printf (" Enter the second number: \ n ");
While (scanf_s (" % f ", & amp; Y)!
=1){
Char c=0;
While (c=getchar ()! )
='\ n'Putchar (c);
Printf (" is not a number, the correct number to the as - 1, 3 or 25, both please enter again ");
}
For (I=10, n=0, l=1; L!!!=0; I *=10)
{
A=(int) (x * I);
L=a % 10;
If (l!=0)
n++;

}
Z=x * y;
If (m==0 & amp; & N==0)
Printf (" % %. * f *. * f=%. * f \ n ", 0, x, 0, y, 0, z);
The else
{
If (m & gt; N)

Printf (" % %. * f *. * f=%. * f \ n ", m, x, m, y, m, z);
The else
Printf (" % %. * f *. * f=%. * f \ n ", n, x, n, y, n, z);
}

break;
}
Case 'd' :
{printf (" Enter the first number: \ n ");
While (scanf_s (" % f ", & amp; X)!
=1){
Char c=0;
While (c=getchar ()! )
='\ n'Putchar (c);
Printf (" is not a number, the correct number to the as - 1, 3 or 25, both please enter again \ n ");
}
For (I=10, m=0, l=1; L!!!=0; I *=10)
{
A=(int) (x * I);
L=a % 10;
If (l!=0)
m++;

}
Printf (" Enter the second number: \ n ");
While (scanf_s (" % f ", & amp; Y)!=1 & amp; & ! ((y & gt; 0.0000001) & amp; & (y & lt; 0.0000001)))
{
Char c=0;
While (c=getchar ()! )
='\ n'Putchar (c);
Printf (" is not a number, the correct number to the as - 1, 3 or 25, both please enter again \ n ");
If ((y & gt; 0.0000001) & amp; & (y & lt; 0.0000001))
{
Printf (" the divisor can not be 0. Both please enter again \ n ");
continue;
}
}
For (I=10, n=0, l=1; L!!!=0; I *=10)
{
A=(int) (x * I);
L=a % 10;
If (l!=0)
n++;
}
Z=x/y;
If (m==0 & amp; & N==0)
Printf (" %. * f/%. * f=%. * f \ n ", 0, x, 0, y, 0, z);
The else
{
If (m & gt; N)

Printf (" %. * f/%. * f=%. * f \ n ", m, x, m, y, m, z);
The else
Printf (" %. * f/%. * f=%. * f \ n ", n, x, n, y, n, z);
}

break;
}

Case 'q' : break;
Default:
{
Printf (" Enter the operation of your choice: ");
nullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnull
  • Related