#include <stdio.h>
int main()
{
int x, y, p, i;
printf ("How many pairs?\n");
scanf ("%d", &p);
for(i=1; i<=p; i++)
{
printf ("Enter two values:\n");
scanf("%d %d",&x,&y);
x = x + y;
y = x - y;
x = x - y;
printf("\n");
printf("After Swapping: x = %d, y = %d\n", x, y);
}
return 0;
}
The program works as intended but it provides output after every single input. I want it to take all the inputs together and show the output at the end.