3 like 0 dislike
20.7k 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 | 20.7k views

116 Answers

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

float a,b;





int main(void)

{
* * * * ** * *** ***
** * * * *** *** * * *
* * * * * ** Ratio: *** * *** * * *
**** * * * **** * Ratio: * * *** ***
* * * * *** * * ** **** * * ***** *

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

float a,b;





int main(void)

{
* * *** ** **** * ***** *
* * ***** * *** * ***
* * ** ** ** *** *** Ratio: ** *** ** ** * *
* * * **** ** *** Ratio: ******** ** *
** ** ***** * ** *** * * ****** *

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

float a,b;





int main(void)

{
* * * **** **** * * * ** ***
*** * ***** * *** * *
***** * ** *** ** Ratio: * * ** *** * * *
* * * ****** Ratio: ** * ** ** ** *
** * *** * ** ** ***** *** ** **** ** ******* *

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



int main()

{
* * ****** ** * ** x=0,y=0,z=0;
****** **** **** * * ** ** ("%f %f",&x,&y);
** *** ***** *** * * ** *
*** * **** * *********** * **** ** ** * *
* * ** *** ** ** * *** * * *
** ***** **** * * ********* * * **** ** * * *** *
**** * ** * *** * *** * *** ***
** *** ** **** * * * ** * * * ****** ***** * *
** ** *** * ** *** ** ** **
** * *** ** *** * ***** * * ******* ** ** **

}
answered by (54 points)
0 0
what if the result of a/b is an integer?
for example 10/2 = 5
0 like 0 dislike
Hidden content!
#include <stdio.h>
#include <stdlib.h>

int main()
{
* ** ** **** * * * * ** a,b;
* * *** ** * *** * ** c;
***** ** *** ** *** **** * * * * **
* * * * *** * * *** ** * ** ******** ** *
* * * * ** ** ** *** ** ** *** ** *** **
* * *** * ** * ** ** ** * * ** ****
* * ****** *** * ***** * * * * * **
* ** ** * * * * ** ***** ** 0;
}
answered by (-258 points)
0 0
prog.c: In function 'main':
prog.c:7:11: error: unused variable 'c' [-Werror=unused-variable]
     float c;
           ^
cc1: all warnings being treated as errors
0 0
prog.c: In function 'main':
prog.c:7:11: error: unused variable 'c' [-Werror=unused-variable]
     float c;
           ^
cc1: all warnings being treated as errors
0 like 0 dislike
Hidden content!
#include <stdio.h>

#include <stdlib.h>



int main()

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

}
answered by (-498 points)
0 0
what if the result of a/b is an integer?
for example 4/2 = 2
Welcome to Peer-Interaction Programming Learning System (PIPLS) LTLab, National DongHwa University
English 中文 Tiếng Việt
IP:172.69.17.58
©2016-2025

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,442 answers
172,219 comments
4,824 users