# answer out put is wrong

asked Apr 29, 2021
#include<stdio.h>
int main(){
int a, b, c, d, e, f, sum, sub, multiplication, divsion;

printf("input 1st no:\n");
scanf("%d" , &a);

printf("input 2nd no:\n");
scanf("%d", &b);

c=a+b, sum;
d=a-b, sub;
e=a*b, multiplication;
f=a/b, divsion;

printf("\naddition is =%d", &c);
printf("\nsub is =%d", &d);
printf("\nmultiplication is =%d", &e);
printf("\ndivsion is =%d", &f);

return 0;

}

+1 vote
answered May 2, 2021 by (360 points)
#include<stdio.h>
int main(){
int a, b, c, d, e, f;

printf("input 1st no:\n");
scanf("%d" , &a);

printf("input 2nd no:\n");
scanf("%d", &b);

c=a+b;
d=a-b;
e=a*b;
f=a/b;

printf("\naddition is =%d", c);
printf("\nsub is =%d", d);
printf("\nmultiplication is =%d", e);
printf("\ndivsion is =%d", f);

return 0;

}
+1 vote
answered May 2, 2021 by (160 points)
#include<stdio.h>
int main(){
int a, b, sum, sub, multiplication, division;

printf("input 1st no:\n");
scanf("%d" , &a);

printf("input 2nd no:\n");
scanf("%d", &b);

sum=a+b;
sub=a-b;
multiplication=a*b;
division=a/b;

printf("\naddition is =%d", sum);
printf("\nsub is =%d", sub);
printf("\nmultiplication is =%d", multiplication);
printf("\ndivsion is =%d", division);

return 0;

}

its best that we step by step go through the changes together.
CONTACT  nelby#5120 on discord for more information.
(or email [email protected]) <3
+1 vote
answered May 3, 2021 by (88,520 points)

For scanf you need to provide the memory address where the value should be stored, (You did this correctly)

However, for printf, you need to provide the actual value (not the memory address of the value). (This is where you erred).

Your code correctly would be as below (removed the & -- memory address of -- operator):

```    printf("\naddition is =%d", c);
printf("\nsub is =%d", d);
printf("\nmultiplication is =%d", e);
printf("\ndivsion is =%d", f);```
answered Sep 9, 2023 by (300 points)

#include<stdio.h>
int main(){
int a, b, sum, sub, multiplication, division;
printf("input 1st no:\n");
scanf("%d" , &a);
printf("input 2nd no:\n");
scanf("%d", &b);
sum=a+b;
sub=a-b;
multiplication=a*b;
division=a/b;
printf("\naddition is =%d", sum);
printf("\nsub is =%d", sub);
printf("\nmultiplication is =%d", multiplication);
printf("\ndivsion is =%.3f", division);

return 0;

}

you can use %f as the specifier for division instead of %d which gives integer division. in case its a decimal output due to division float will fail hence better to use floating division. also if u have to improve for better division better to consider zero division error into consideration.

answered Sep 10, 2023 by (140 points)

#include<stdio.h>
int main(){
int a, b, c, d, e, f, sum, sub, multiplication, divsion;

printf("input 1st no:\n");
scanf("%d" , &a);

printf("input 2nd no:\n");
scanf("%d", &b);

c=a+b;
d=a-b;
e=a*b;
f=a/b ;

printf("\naddition is =%d", c);
printf("\nsub is =%d", d);
printf("\nmultiplication is =%d", e);
printf("\ndivsion is =%d", f);

return 0;

}