Computer Science, asked by aninditadas651, 8 hours ago

Q. Write a qbasic program:

To accept values of two numbers and interchange their values.



ANSWER FAST PLEASE...!!​

Answers

Answered by pereirajosiah03
0

#include<stdio.h>

int main()

{

int a=10, b=20;

printf("Before swap a=%d b=%d",a,b);

a=a+b;//a=30 (10+20)

b=a-b;//b=10 (30-20)

a=a-b;//a=20 (30-10)

printf("\nAfter swap a=%d b=%d",a,b);

return 0;

}

Answered by chatterjeearchisman
6

Answer:

To be honest, I'd have done it in C++

But, as you said QBasic, I had to do it there.

Anyways, here goes

Explanation:

CLS

LET A= 50

LET B=100

PRINT A, B

C=A

A=B

B=C

PRINT A, B

END

Similar questions