3 like 0 dislike
8.3k views

Write a program that let the user input two number and displays the result as the example below:

輸入兩個數字,做加減乘除的運算

Example input 1:

5 6

Example output 1:

5+6=11
5-6=-1
5*6=30
5/6=0.833333

Example input 2:

1.23 3.45

Example output 2:

1.23+3.45=4.68
1.23-3.45=-2.22
1.23*3.45=4.2435
1.23/3.45=0.356522

Remember: Your output maybe 100% correct, but your code matters!

[Exercise] Coding (C) - asked in Chapter 3: Formatted Input/Output by (12.1k points)
ID: 25729 - Available when: Unlimited - Due to: Unlimited

edited by | 8.3k views

116 Answers

0 like 0 dislike
Hidden content!
#include * * * *

#include ** ** ** ** ** *



int main()

{
* * * * * ** * *** * ** a = 0;


** *** *** * ** * ** * * * * b = 0;


*** **** * ** ** * * sum = 0;


* * * * ** **** **** *** * ** ** * * &a);


* **** *** * ** * * * * * * * * * * &b);


** ** **** * *** *** = a + b;


* * * * * * * * ** *** *** * * ** * * * *** * * a, b, sum);


********** * ***** * * = a - b;


** ** * ** **** * ** * ** * ** **** * **** * a, b, sum);


** * * * * * ****** ** = a * b;


* **** ***** ** ** *** * * * * *** **** a, b, sum);


***** * * * ** *** * = a / b;


**** * * ** **** *** * * ** * * * * * a, b, sum);
* * * *** * * ** * ** 0;

}
answered by (-285 points)
0 like 0 dislike
Hidden content!
** * ** * *



int * *

{

float num1;
float num2;



** *** * *** * * * ** * ***


** * sum = * *
float * * *
* **** ** * * * *
float *** * ****

* **** * * * ** * **
* * ** *** * * ** **
*** * ** * ** *** * **** * ***
* ** ** * * * ***** **** **



* 0;
}
answered by (-107 points)
0 0
-----------Re-judge-----------
Case 0: Correct output
Case 1: Correct output
0 0
-----------Re-judge-----------
Case 0: Correct output
Case 1: Correct output
0 like 0 dislike
Hidden content!
#include ** ** * *****

#include *** * ** **



int main()

{
** *** *** * ****** * a = 0;


** * ** * ** ** **** b = 0;


* * * ** * * ** * * * *** sum = 0;


** * *** ** ** * **** *** ** ** * &a);


*** ** ***** ** * *** *** *** * * * * *


** ** *** * * *** * * * * = a + b;


* * ****** ** * **** * ** * = ** ** * a, b, sum);


* **** * *** ** *** * = a - b;


****** ** ** **** ***** * **** ** **** = **** ** a, b, sum);


** ** * * * * * * * = a * b;


**** ************* ** ** * *** * = ** ** a, b, sum);


* * * * * **** * ** * ****** = a / b;


**** ** *** ******* * * * *** ** ** ***** = *** ** a, b, sum);
*** * ** ** * * * ** 0;

}
answered by (-285 points)
0 like 0 dislike
Hidden content!
* * * *






* **



{



float num1;

float num2;






* ** * * *** * * * * *** ****




* sum = * *

float **** * * * ** **

float **** * * *** *

float ** *** *


*** * * *** * * ****** * ** ****
** * * ** *** * * * ** * * * *
* * * * * *** * **** *** ** *
**** *** * * * *** ** **** **






0;

}
answered by (-107 points)
0 like 0 dislike
Hidden content!
#include * *** * * *****
** * ** ***** ** * ** *



int main()

{
* ** * * * ****** * * * a = 0;


*** ** *** **** *** ** b = 0;


**** **** * ** * * ** sum = 0;


* ** ** * ******* * * ** *** * * *** **


****** * * * ** ** * * ***** * ****


***** ** ******* * * = a + b;


*** ** ** *** ** *** ** * * + %f = * ** * a, b, sum);


* * ** * ** * * * * * = a - b;


* ** * ** * * * ** **** * ** * * - %f = * * ** a, b, sum);


**** * **** ** * = a * b;


* ******** ** * *** ** ** * * * %f = ** ** * a, b, sum);


* * * ****** ** * * = a / b;


* * *** ** * * ***** * ** * * / %f = *** * * ** a, b, sum);
* * ** * *** *** * ** **** 0;

}
answered by (-285 points)
0 like 0 dislike
Hidden content!
#include * ** *** **** ** *
* * ** * * * * *



int main()

{
* * ****** * *** * ** * * * a = 0;


* *** * * * * * * * b = 0;


* ** * ** * ** *** * sum = 0;


**** * ** **** * * *** ***** * **** ** * * * * * *


**** ** ** * *** ** ** *** ***** * *** **


* * ** **** ** ***** *** = a + b;


* **** ** * * * * * ** ** * * %f + %f = ** ** a, b, sum);


* ** * * *** ** * *** * * = a - b;


* ** ***** ** * ** *** * * * *** *** - %f = * a, b, sum);


*** * * * * * * * * = a * b;


* * *** ** ** ****** * * ** * %f = *** ** * a, b, sum);


* * * * ** **** **** * * * = a / b;


* ** **** ** * * **** ** / %f = * * * ** ** a, b, sum);
** * * * ** ***** * ** *** 0;

}
answered by (-285 points)
0 like 0 dislike
Hidden content!
#include<stdio.h>

int main()

{

    float a,b,c,d,e,f;
* * * * * *** * * * * ** %f",&a,&b);
** * *** **** ***** *** *** *
*** * *** *** * ****** ***
** *** ** ** * * *
* * ** * * * ** ** **
* * * * * ** * * * ******* **** * **** ******* ****
* *** * ** *** ** * *** ** **** * *** *** * * *
**** ** * * * * * ** ** ** * ****** * ** ****
* * * ** ****** *** ** * ***** ** * * **
* * ** ** * * ** **** 0;



}
answered by (-255 points)
0 like 0 dislike
Hidden content!
*** * ** * **






* * *



{



float num1;

float num2;






** ** * * * ** ** * * * **




*** sum = * ** **

float * * ** * * ***

float * * * * *

float ** ** ** *


* **** * *** ** * *** *
*** * ** ** * ** * ** *
*** *** * * *** ****** ** * ** **
* *** * ***** ***** ** * ** * **






* 0;

}
answered by (-107 points)
0 like 0 dislike
Hidden content!
#include<stdio.h>
int main()
{
*** **** ** * *** * *** *** a = 0, b = 0,c = 0;
** **** ** ** * ** ***** * ** * * * *** ***
******** **** **** * = a + b;
* * * **** * ** * * ** * ** ** * *** ***
*** ** * * * *** = a - b;
** * ** * ** ** ** * *** * * ** ** * **
** ******* * * ****** ** = a * b;
** ** *** ** * ** * * ** * * * ****** *****
* * * * * ** = a / b;
*** * ****** * * * * * ** * **** ** *

return 0;
}
answered by (-141 points)
0 0
-----------Re-judge-----------
Case 0: Wrong output
Case 1: Wrong output
0 0
-----------Re-judge-----------
Case 0: Wrong output
Case 1: Wrong output
0 like 0 dislike
Hidden content!
#include <stdio.h>



int main (void)



{
**** * *** ** ** ***** * * a,b;
****** * *** *** * * ******* * ** * * ****
** *** ** * * ** ***** **** ** * * ***** * * * * * * * *** ** ** * * ** * **** *


** *** *** *** * * * ** 0;

}
answered by (-204 points)
Welcome to Peer-Interaction Programming Learning System (PIPLS) LTLab, National DongHwa University
English 中文 Tiếng Việt
IP:172.70.126.11
©2016-2024

Related questions

1 like 0 dislike
0 answers
[Resource] asked Oct 14, 2017 in Chapter 3: Formatted Input/Output by thopd (12.1k points)
ID: 26948 - Available when: Unlimited - Due to: Unlimited
| 14 views
12,783 questions
183,443 answers
172,219 comments
4,824 users