1 喜歡 1 不喜歡
1.9k 瀏覽

Please write a simple program that performs calculation and, shows its result equals to '10'

** There is no restriction as long as the result indicates 10 from its calculation **

** However, your codes should NOT be the same as the given example **

 

Example

#include <stdio.h>
int main(){

int a, b, c, d;

scanf ("%d %d %d", &a, &b, &c);

d = a + b * c;

printf ("%d", d);

return 0;
}

Input

2 2 4

Output

2 2 4
10

Suggestion

  • Try to apply AdditionSubtraction, MultiplicationDivision in your codes
  • Be advised that 'Order of Operation' is crucial. The relative precedence levels of operators found in many C-style languages are as follows

[練習] 開放式問答 - 最新提問 分類:Chapter 2: Syntax structure of the C language | 用戶: (5.9k 分)
ID: 25725 - 從幾時開始: 無限制 - 到幾時結束: 無限制

修改於 用戶: | 1.9k 瀏覽
1 0
#include <stdio.h>
#include <stdlib.h>

int main(int argc, char *argv[]) {
    int a, b, c, d;
    /* prompt the user
    and read input numbers */
    printf("Input three numbers separated by space: ");
    scanf("%d%d%d", &a, &b, &c);
    //computation itself
    d = a / b * c;
    //print the result
    printf("%d / %d * %d = %d", a, b, c, d);
    return 0;
}
input 2 1 5 output 2 1 5 10

15 個回答

0 喜歡 0 不喜歡
內容已隱藏
* ** * * ** **
** * *
* * b, c,
* * %d * *** * * ** * *** *** *
** = + b * *
* ** * ** *
100/100 最新回答 用戶: (244 分)
0 喜歡 0 不喜歡
內容已隱藏
* ***
*** * *

* * **


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


* = ( a + b ) *

** **** ***
*
**
*
100/100 最新回答 用戶: (449 分)
0 喜歡 0 不喜歡
內容已隱藏
***** * **
* * * *


* ** * **


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


* = * * * + *


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


* * *

}
100/100 最新回答 用戶: (283 分)
修改於 用戶:
0 喜歡 0 不喜歡
內容已隱藏
* **** *** * * ***


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


** * ** ** ** * * or *** ** * ** ** * *** * * ***** * or *** **


** * * * * * {


** ** c, d,


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


** ******** %d %d *** * ** ** * * * **** **


= a + b - c * d;


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


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



**** *


*


* * * 9 2


***** *
100/100 最新回答 用戶: (221 分)
0 喜歡 0 不喜歡
內容已隱藏
* ** ** * **
** * *
* c, *
* ** %d ***** * * * *** ** *
* = a * c +
* * *
* **
}
100/100 最新回答 用戶: (220 分)
0 喜歡 0 不喜歡
內容已隱藏
** * ** * * * *
* * ** *** * *


** ** b, c, d;


* ** * ** * * 3 * * * ** *** *** ** ** **


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


= a + b + *


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


*
*
100/100 最新回答 用戶: (281 分)
1 喜歡 0 不喜歡
內容已隱藏
** * * * *** * *

int


*** * a, b, c;


* * **** * ** the ** ** ** **** ***** *** ** **
* * * * ****** * * *
* * * * **** * * * the * * *** ** **
* * * * * ** *
* ** ** ** * ** * the * *** * ***** * ** ** *
* * *** * *** * *** **



opp = a + b * c;


** * * * * * * * is = **** * **


** 0;

}
100/100 最新回答 用戶: (268 分)
1 喜歡 0 不喜歡
內容已隱藏
*** * ** **
* * * ** * * ** * argc, char **** {
* * ** * * * a, b, c, d;
* * * *** ** * *** * * the user and read * * *** **** * * * *
* ** ** * ** ** ** *** *** three * * * ** by **** ****
*** * * ** * ****** * ** ** ** * ** ** * * ***
* *** ** *** *** * *
** ** ** ** * = a + b * c;
** ** ** * * * ** the **
** * ** ** ** ** ** * * * * + %d * %d = *** ** a, b, c, d);
**** *** * * * *** * 0;
* * 4 ** * * 4 2 10
100/100 最新回答 用戶: (273 分)
0 0
Good job
1 喜歡 0 不喜歡
內容已隱藏
*** * * * * * * **
* * *** **** **


* **** * * ** * {
* * *** a, b, c, d;
*** * * * the **
***** * ** * **** */
* * * * * *** *** * * * * by * * *** * **
**** * * * ** ** * ******** * * ** *** ******
* **** * * * ** *

d = a - b / c;
* ****** the * **
* * * * * * ** ***
*** * * * 0;

}





* 8 2


***


8 2



10
100/100 最新回答 用戶: (290 分)
重新顯示 用戶:
0 0
Nicely done, keep up.
1 喜歡 0 不喜歡
內容已隱藏
* * *** ****
** *** * ******** **
** * ** * * * {
*** a, b, c;
* * ** *
* ** * */
* ** * ** ** by ** *
*** ** ** ** * * * *
*** * * ***

c = a + b;
*** * **
** ** * + %d = ** *
* **
*
* * * ** *
* 7
*
*
** 7
10
100/100 最新回答 用戶: (269 分)
0 0
Nicely done
Welcome to Peer-Interaction Programming Learning System (PIPLS) LTLab, National DongHwa University
English 中文 Tiếng Việt
IP:172.70.131.161
©2016-2025

沒有找到相關問題

12,783 問題
183,442 回答
172,219 留言
4,824 用戶