Write a program to input two integers in variables num1 and num2, then interchange the value,
(Suppose num1 = 10, num2 = 20, then after interchanging, it should be num1 = 20 and
num2 = 10). Print the values of num1 and num2 before interchanging the values and after
interchanging the values with suitable message.
Answers
Answered by
3
Answer:
#include<stdio.h>
int main()
{
int num1,num2,temp=0;
printf(" \nEnter two number : ");
scanf("%d %d",&num1,&num2);
printf("\nThe numbers are num1= %d and num2= %d",num1,num2);
temp= num1;
num1=num2;
num2=temp;
printf("\nThe swapped numbers are num1= %d and num2= %d",num1,num2);
return 0;
}
Hope this helps you.Please add as Brainliest if it is correct.
Similar questions