I am very new to programming and it seems like I've hit a wall with this code I was experimenting with. I'd appreciate it if someone could explain why this comes out weird and what I should do to fix it.
#include <stdio.h>
int main()
{
int a, _a, b, _b, c, _c, d;
printf("Enter 1 pair of numbers\n");
scanf ( "%d ,%d", &a, &_a );
printf("Enter another pair of numbers\n ");
scanf ( "%d ,%d", &b, &_b );
c = a + b;
_c = _a + _b;
d = c + _c;
printf( "The sum of first numbers in each pair is %d\n", c);
printf( "The sum of second numbers in each pair is %d\n", _c);
printf( "the sum of all the numbers is %d\n", d);
return 0;
}
For some reason, the output is like this:
Enter 1 pair of numbers
3
4
Enter another pair of numbers
5
The sum of first numbers in each pair is 7
The sum of second numbers in each pair is -785649472
the sum of all the numbers is -785649465
Thank you so much!