Beginner problem with adding using printf
I'm trying to make a basic C program that can do a math operation such as the one below.
x + y = sum
So what I've got here is:
#include<stdio.h>
Code:
main()
{
int x = 2, y = 3, sum;
printf("%i plus %i is %i", &x, &y, &sum );
sum = x + y;
getch();
}
and I'm trying to get it to just say 2 plus 3 is 5, but i'm getting something like:
0 plus 0 is 234934289.
Is it not possible to do calculations using just printf, or do i have to use scanf and enter the equation before i get the output?