0 like 1 dislike
7.9k views
Show more...
[Exercise] Coding (C) - asked in Chapter 5: Selection Statements by (5.2k points)
ID: 28934 - Available when: 2017-10-26 18:00 - Due to: Unlimited

reopened by | 7.9k views
0 0
We will continue this question in few days
0 0
Everything is fixed. Enjoy your time with The Judge :)
0 0
ANNNNNNNNNNNNNNNNNNNNNNNNNNGRYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY
0 0
Your code has newline at the end sometime. You learned this lesson many times!
0 0
After i correct the newline in my code,there is still wrong output.However,I had run the program in Codeblocks.The output is still as well as the result. Seeking for help.
0 0
your output lack of 1 space at line 8 when print out "Roots of ...". Please be careful with all small details when working with online judge

56 Answers

0 like 0 dislike
Hidden content!
****** * **** *
* * ** *** *

int main() {
** ***** ** * ** ** * * ** **
* * **** * ** ** ** * *** %f * * * &a, &b, ** *
* ** * * ** *** * * *** * * *
* ** **** ** **** * * ** **** * {
****** * * * **** * ** * * ** **** ****** ** of %.2fx^2 + %.2fx + %.2f = 0 are complex and ** * ** = * ** = * * * * a, b, c, (-b)/(2*a), * ** (-b)/(2*a), *** *** *
** ** ** ***** *****
****** *** ** * * * * if(d==0) {
* **** *** ** ** ** ** * * ***** * * ** * *
* **** * **** * ***** *** *** * ** * ****** ** * ***** * of %.2fx^2 + %.2fx + %.2f = 0 are real and same\nx1 = x2 = *** * **** a, b, c, x1);
* * **** ** * *** * **
* * ** * * **** * ** * * * *** {
* ** * * ** ** * * * * * ***** * * * * * ** *** *
** * * **** * * ** * * *** *** * * ** * * * ** *
*** * ****** ** * * * ** ** * ** * * ** * * * **** * ** ** of %.2fx^2 + %.2fx + %.2f = 0 are real and * *** = %.2f\nx2 = *** a, b, c, x1, x2);
******* ** *** ** ** *
}
answered
0 0
Case 0: Correct output
Case 1: Correct output
Case 2: Correct output
Case 3: Correct output
0 like 0 dislike
Hidden content!
#include * * ** * **
* ** * * ****
#include * ** * ** *****

int main()
{
* * *** ** ********* * *** *** * *
* * * * * **** ******* * %f ***** **** **** **** * * * *
*** **** *** * **** * ** * * * **
* * * *** *** * ** **
** ****** * *** * *** ** * *** *
* ** ** ** ** * * *** **
* **** * ** ** * * * * * * **** of %.2fx^2 + %.2fx + %.2f = 0 are real and * = %.2f\nx2 = ** ** ** ****
*** ** * ***** * ** * * if(D==0)
** **** ** *** * ** ** * * **** ** of %.2fx^2 + %.2fx + %.2f = 0 are real and same\nx1 = x2 = ** * * **
** * **** * * ***** ** **
* * * * *** ** **** * * ** * * * * of %.2fx^2 + %.2fx + %.2f = 0 are complex and * * * = ** ** * = ** * ** * *** ** * **** * *** * * * * ** *
** * * ** * ** * **** *** * 0;
}
answered by (-498 points)
0 0
Case 0: Correct output
Case 1: Correct output
Case 2: Correct output
Case 3: Correct output
0 like 0 dislike
Hidden content!
#include *** *** ** ***
* ** ***** ** *
*** * * * **** *

int main()
{
** * ** **** * ** * ** * *** ** **** *
* **** ** * ** ****** * * * %f * * * ** * * ** ** * * **
** * ** ** * * ** *
* ** ** ** * * * * *** * * * * **
**** * * *** * *** * * * * * * ***
** ***** *** * * * **
** * ** ** *** * **** * * * of %.2fx^2 + %.2fx + %.2f = 0 are real and ** * **** = %.2f\nx2 = ** * ** **
* * * ** ** * * * ** **
* ** *** * ** ** ** *** * * of %.2fx^2 + %.2fx + %.2f = 0 are real and same\nx1 = x2 = * ***** * * *
*** * * * ******** *
** * * ** * ** * ** * of %.2fx^2 + %.2fx + %.2f = 0 are complex and ** * * = %.2f + ** = %.2f - * * * *** *** * ****** ** * ** * * *
***** * * * * ******* * 0;
}
answered by (-498 points)
0 0
Case 0: Correct output
Case 1: Correct output
Case 2: Wrong output
Case 3: Correct output
0 like 0 dislike
Hidden content!
#include <stdio.h>
#include <stdlib.h>
#include<math.h>
int main()
{
** * *** *** ** a,b,c,x1,x2,D;
* *** *** ******** *** ** * **** * * %f ** * **** * * ** ***
* * * ** ** * * * ** *** ** *
** * ***** * **** * = (-b + sqrt(D))/(2*a);
** **** *** *** * * * = (-b - sqrt(D))/(2*a);
* ** ***** * ** * **** *** **
** * ** * * * ***** * * *** * ** * **
* * * ** ** * ** * * * ** * ** **** * * * ** ** * *** * * of %.2fx^2 + %.2fx + %.2f = 0 are real and different\n",a,b,c);
* * **** *** ** *** * * ** * * * * *** * ** *** * * * **** **** * * ** **** = %.2f\n",x1);
** *** * ** * * * * *** ** * * ** ** *** *** ******** ** * ** * * ***** = %.2f",x2);
* * ** * ** *** * *** ** * ** * ***** * *
** * * * * *** * *** * *** if(D==0)
** ** ** **** ** * * *** * **** *** ******* * *
* * * * *** **** *** * ** ** * * * * *** **** * ******* * ** *** of %.2fx^2 + %.2fx + %.2f = 0 are real and same\n",a,b,c);
* ** ** ** * ** ** ** *** ****** * *** ***** * *** * ** ****** * * * ** * ******* = x2 = %.2f",x1);
******** ** * ** **** * * **** ***** * *
* * * * * ** ** *** *** * *
*** *** ****** *** * * ** * * * * *** *
* ***** * ** * * * ** * * *** * ** ** * ** ** ** ** *** * *** **** **** * of %.2fx^2 + %.2fx + %.2f = 0 are complex and different\n",a,b,c);
***** ** * **** **** * ** * * ** ** *** * * * * * *** * **** **** * * * = * ** **** * * * **
* ** *** * ** ** * * ** ** ** ** ** ** *** ****** ** *** ** ****** * * *** * *** * = * * * * * **** * ***
***** ** ** ** * ** ** * *** * **
* ** * * * **** * * 0;
}
answered by (-258 points)
0 0
Case 0: Correct output
Case 1: Correct output
Case 2: Correct output
Case 3: Correct output
0 like 0 dislike
Hidden content!
#include <stdio.h>
#include <stdlib.h>
#include<math.h>
int main()
{
* * * * *** * * a,b,c,x1,x2,D;
*** * * * * * ** *** * * %f * ** * *** *** ** **
* * ** * * * * * * *
* **** **** ** * * ** = (-b + sqrt(D))/(2*a);
** ********* ** *** * = (-b - sqrt(D))/(2*a);
** * * ** ** ** ** **** **** ** * *
* * * * *** ** ** *** **** * ** ** ** * *
* ** * ** ** * * * ** **** * * *** *** * ** * *** * *** **** * of %.2fx^2 + %.2fx + 1.00 = 0 are real and different\n",a,b,c);
*** **** *** ** ** * * * * ***** ** ** * ******* ** * * * * * * ***** * * * = %.2f\n",x1);
* ** * * * * *** * * *** * ** **** * ** * ****** ** * ** * * **** = %.2f",x2);
***** * * ** * *** * ** * ** ** *** *
* *** * ****** ***** * if(D==0)
* * *** *** ***** *** * * ** *** *** *** * ***
*** * ** * ******** * **** *** * ** *** ** * **** **** ** ***** * * ** * of %.2fx^2 + %.2fx + 1.00 = 0 are real and same\n",a,b,c);
* ** **** * ***** ****** *** ** ** * * * * ** * *** * * ** * * * * * * = x2 = %.2f",x1);
* * ** * * * ** * * * * * * * ** * ** *
** * **** * * *** *
** ** * * * * ** *** ** * * * * ** ****
** * * *** ** * * * ***** * * *** * ** * * **** *********** * * **** ** of %.2fx^2 + %.2fx + 1.00 = 0 are complex and different\n",a,b,c);
* * * * * * ** *** * * * **** * ******* ** * ** * ****** *** **** = * * *** **** * *
* ** ** * * * * *** ** * * * ******* * ********* * ** * * ** = *** ***** ***** * ***
* * * * *** ** *** * * * ******** ** * ** ** ******
* * **** * *** ** ** **** ** 0;
}
answered by (-258 points)
0 0
prog.c: In function 'main':
prog.c:13:20: warning: too many arguments for format [-Wformat-extra-args]
             printf("Roots of %.2fx^2 + %.2fx + 1.00 = 0 are real and different\n",a,b,c);
                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
prog.c:19:20: warning: too many arguments for format [-Wformat-extra-args]
             printf("Roots of %.2fx^2 + %.2fx + 1.00 = 0 are real and same\n",a,b,c);
                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
prog.c:24:20: warning: too many arguments for format [-Wformat-extra-args]
             printf("Roots of %.2fx^2 + %.2fx + 1.00 = 0 are complex and different\n",a,b,c);
                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
0 like 0 dislike
Hidden content!
* * * ** **
* * *** * *
int main()
{
** ** * *** *** ** ** ** a,b,c,D = 0,x1 = 0,x2 = 0;
**** * * * * * **** ** ** * * *** * * ****** **

*** * *** ****** ** **** * * * * of %.2fx^2 + %.2fx +%.2f = 0 **** ** **
**** ** ** *** * ** = (b*b-4*a*c);
* * * * ** ** * * **** * (D < 0)
** * ** * * *
** **** * ** * * * ** ** **** * * * * complex and ** * **
* * ** **** * ******** * = * * * * **** * * *** *** *
*** * ** * * * * *** *** *** * * = * **** * ** ** **** ***** ***
* ** ** ** * ** * * *
**** ********** ***** (D > 0)
***** * ** *** * ** ** **
**** ***** * ** * * ** * ** ***** real and * *** ** * *
* ** * * *** * * **** ** * = * * * * + sqrt(D))/(2*a));
* *** * **** **** ***** = %.2f",(-b - sqrt(D))/(2*a));
** * ***** * ****
* ***** * *** **** * * (D == 0)
* * * * * * ** * **
* * ** * * *** * * * ** * ** real and same\n");
* * ** * * ** * * ** * * ***** * ** * * ** = x2 = %.2f",(-b + sqrt(D))/(2*a));
**** * * * *** * * *
}
answered by (-214 points)
0 0
Case 0: Wrong output
Case 1: Wrong output
Case 2: Wrong output
Case 3: Wrong output
0 0
your output lack of 1 space at line 8 when print out "Roots of ..."
0 like 0 dislike
Hidden content!
**** * * * *
** * * * *****
int main()
{
* * * *** *** * * ** ** a,b,c,D = 0,x1 = 0,x2 = 0;
** * *** * * * * * ***** ** * ****** * ** ****** ***

* * * * ***** ** * * * ******** of %.2fx^2 + %.2fx +%.2f = 0 *** * * * *
*** ** ** **** * * * * ** = (b*b-4*a*c);
**** ** * ** * * * * (D < 0)
*** * * * * * *
* ** * * * * ******* ** ** * * complex and * ** * ** * **
*** * ** * ***** * * ** ** * * = ************ * * **
**** *** * * **** ** *** * * = ** *** ** * * * ** **** **
***** *** * * *** ****
** * ******** ** *** (D > 0)
* * * *** * ** **** * *
* * **** * * * **** * **** * ** * real and * ** * ** **
****** * ** * *** *** ** ********* ** = ** *** + sqrt(D))/(2*a));
* * * **** * * * * * * *** = %.2f",(-b - sqrt(D))/(2*a));
* *** *** ** *** *
* * * **** *** ***** * * (D == 0)
* * * * * ****** *
*** * ** * *** * ** ** *** * real and same\n");
** ******** * * ** ** **** ** ** * = x2 = %.2f",(-b + sqrt(D))/(2*a));
* ***** * * * *
}
answered by (-214 points)
0 0
Case 0: Wrong output
Case 1: Wrong output
Case 2: Wrong output
Case 3: Wrong output
0 like 0 dislike
Hidden content!
** ***** * ***
* *** *** *
int main()
{
* ** ****** * * * * ** a,b,c,D = 0,x1 = 0,x2 = 0;
*** * *** *** * * * * **** * *** * **** * ***** * ***** ** ***

* *** ** ** ** * * * * * of %.2fx^2 + %.2fx +%.2f = 0 ** * *
** * * * * * ** * * * * = (b*b-4*a*c);
** * * **** * ** * (D < 0)
* *** * ** * * ** *
** ** ** * ** * ** * ** ** * * * complex and **** * * * *
* **** **** * *** * ***** * * * *** * = * * * * * * *** * ** * **
**** * * * * * * ** * * * * * = * ** *** * ** * * * * * *
** * ** * ** ** * * * * *
*** * **** ** * * * (D > 0)
** * ** ******** **** ** *
* ** ** * ** *** * * * * ** ** real and * * *** * **
*** * ** ***** * ** * ** = ** * ** + sqrt(D))/(2*a));
*** *** ***** ** * **** *** * * ** = %.2f",(-b - sqrt(D))/(2*a));
* *** **** ** * ** *
**** **** *** ***** *** (D == 0)
* * **** * * *** * **
** ** * ** * * *** * ** * * * * * real and same\r\n");
* ** * * * * * ** * * ** *** *** = x2 = %.2f",(-b + sqrt(D))/(2*a));
* * * *** ** **
}
answered by (-214 points)
0 0
Case 0: Wrong output
Case 1: Wrong output
Case 2: Wrong output
Case 3: Wrong output
0 like 0 dislike
Hidden content!
* * ** * **********
*** ** * * **
int main()
{
* * ** ** * *** ** a,b,c,D = 0,x1 = 0,x2 = 0;
* ** * * ** * * *** * * * * ** * * * * ** *

* * * * **** ** * ** ** **** of %.2fx^2 + %.2fx +%.2f = 0 *** **** * **
** * ** * *** * ** ** = (b*b-4*a*c);
* * * *** ******** (D < 0)
* * ** ** ** *** *
******* **** ** * * ** * **** ** complex and ****** * **
* ** ** * ** * * * ** *** * = * * * ** ** *** **** *
** *** ***** * ** * * * ** = ** ** *** * ** ** ** * *
* * ** ** * ****
* ** * ** *** ** ** *** (D > 0)
* ** * * ** * * ***
** * ** *** ****** *** * * *** real and **** * ****
* * * * ** ** * *** * * * * * = * ** * * + sqrt(D))/(2*a));
* ** * * * ** * ******* *** **** = %.2f",(-b - sqrt(D))/(2*a));
*** * ** * * *** ** * *
** * *** *** ** * (D == 0)
*** ** *** * * *** * *
* ** * **** * * ** ** ** * *** * real and same\r\n");
** * ** * ** *** * * * **** **** = x2 = %.2f",(-b + sqrt(D))/(2*a));
* * *** ** * ******
}
answered by (-214 points)
0 0
Case 0: Wrong output
Case 1: Wrong output
Case 2: Wrong output
Case 3: Wrong output
0 like 0 dislike
Hidden content!
** ** * *** ** * *
* *** * ** * *
int main()
{
*** ******* ** **** * a,b,c,D = 0,x1 = 0,x2 = 0;
** * * **** ***** ** * * * *** ****** * ***

** ** * **** * * ** ** * ** * * * of %.2fx^2 + %.2fx +%.2f = 0 are",a,b,c);
*** * ** * * ** ** * = (b*b-4*a*c);
* *** * *** * * ** * * * = (-b + sqrt(D))/(2*a);
** * ** *** ******* *** = (-b - sqrt(D))/(2*a);
* * * ** **** ** ** (D < 0)
* ** **** * ** ****** *
* **** * * ** *** * ** ***** ** complex and * ** ** * **
** * ** ** * *** * ** ** * ** = *** * * ***** * *** **
*** * ** *** ***** * = * *** * * *** ** * * *
** *** * * * * * *** **
***** * ** ** * ** (D > 0)
** * * *** ** * *****
**** * ** ** * * * *** * ** real and * * * ***
* ** * *** * *** ***** ***** = * *** * * *****
* *** *** *** ***** * * *** * * * * = %.2f",x2);
* * * **** ** ** * * ** **
*** * **** **** * * (D == 0)
** ** ***** * *** *****
* * ***** * ** * ** *** real and same\r\n");
* ** ******** * * ** *** * * * *** = x2 = %.2f",x1);
* * ** *** * *** **
}
answered by (-214 points)
0 0
Case 0: Wrong output
Case 1: Wrong output
Case 2: Wrong output
Case 3: Wrong output
Welcome to Peer-Interaction Programming Learning System (PIPLS) LTLab, National DongHwa University
English 中文 Tiếng Việt
IP:172.69.6.166
©2016-2025

No related questions found

12,783 questions
183,442 answers
172,219 comments
4,824 users