My issue
What is going wrong in code
My code
#include <stdio.h>
int main() {
int a, b, temp;
// Input two variables
printf("Enter two numbers: ");
scanf("%d %d", &a, &b);
// Swapping using a third variable
temp = a;
a = b;
b = temp;
printf("Using third variable: %d %d\n", a, b);
// Reinitializing the values for the second case
printf("Enter two numbers again: ");
scanf("%d %d", &a, &b);
// Swapping without using a third variable
a = a + b;
b = a - b;
a = a - b;
printf("Without using third variable: %d %d\n", a, b);
return 0;
}
Learning course: Learn C Programming
Problem Link: https://www.codechef.com/learn/course/rcpit-programming-c/RCPITLPC07/problems/LJAJAG21