1 like 1 dislike
4.1k views

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

[Exercise] Essay (Open question) - asked in Chapter 2: Syntax structure of the C language by (5.9k points)
ID: 25725 - Available when: Unlimited - Due to: Unlimited

edited by | 4.1k views
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 Answers

1 like 0 dislike
Hidden content!
*** * * * * * *** *
* *** *** * ** *
** * * ** ** {
*** a, b, c;
* *
* * * * */
** **** * ** * * by * * **
* *** * * * * ** ** * * **
** ***** * *

c = a + b;
* * * * *
** * ** + %d = **** * *
* **
*
** * **
* 6
* ** *
*
* 6
10
100/100 answered by (243 points)
0 0
Great
1 like 0 dislike
Hidden content!
* * *** * **** *

* ** ** * * * ***

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


* * * *


* ** * *


*** * * ** *


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


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


****** * *


* = a +


* ** ** ***


** ** + = * * * * *


***





** *
*

* ** *

***


5
*
100/100 answered by (269 points)
0 0
Good job
1 like 0 dislike
Hidden content!
* *** * *** * ***
** ** ** * ** * ** ** %d * ** *** * * *** = a * b + * ** ** ** * **** *** * *
* *
* *
** * 1 *** * 1 + 8 = 10
100/100 answered by (271 points)
reshown by
0 0
Good job
1 like 0 dislike
Hidden content!
* * * *** * *** * * * ** ** ** *** * * * **** ** the * * * or add * * own ** *** * ** ** or * ** * * * ** * * ** a, b, ** the * *** * * * * * ** * two * * * ** by ** * * ***** * * * ** *** ** = a + ** *** * * * **** * + %d = * a, b, * * ** * * * *
100/100 answered by (252 points)
0 0
Good job
1 like 0 dislike
Hidden content!
* * * **** *
100/100 answered by (153 points)
reshown by
0 0
We have already received your codes. Nicely done.

#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;
}
Welcome to Peer-Interaction Programming Learning System (PIPLS) LTLab, National DongHwa University
English 中文 Tiếng Việt
IP:104.23.197.5
©2016-2026

No related questions found

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