Hello,
I am in the process of learning C and I'm stuck on this code...
The object is for the user to give 2 integers which will ultimately be multiplied, subtracted and added together. The point which I get stuck at, is how to put the result of one statement into that of another:
If the first input is 78 and the second is 83, this should be the result:Code:#include <stdio.h> int main() { int a /*first input*/; int b /*second input*/; int c /*result of a + b*/; int d /*result of a - b*/; int e /*result of a * b*/; printf("Enter the first number:"); scanf("%d", &a); printf("Enter the second number:"); scanf("%d", &b); c = a + b; d = a - b; e = a * b; printf("\na+b=%d\n", c); printf("a-b=%d\n", d); printf("a*b=%d\n", e); return 0; }
Enter the first number:78
Enter the second number:83
78+83=161
78-83=-5
78*83=6474