google.com, pub-6167773875660516, DIRECT, f08c47fec0942fa0 Write a program to interchange two numbers in c or swapping of two numbers using third variable in c. or Write a c program to swap two numbers. - 2nd puc computer science

Write a program to interchange two numbers in c or swapping of two numbers using third variable in c. or Write a c program to swap two numbers.

Write a program to interchange two numbers in c

write a c program to interchange the value of given two integers,
swapping of two numbers using third variable in c,Write a c program to swap two numbers

#include<stdio.h>

#include<conio.h>

void main()

{

int a,b,temp;

clrscr();

printf("Enter two numbers\n");

scanf("%d%d",&a,&b);

printf("Before interchanging a=%d and b=%d\n",a,b);

temp=a;

a=b;

b=temp;

printf("After interchanging a=%d and b=%d",a,b);

getch();

}

Output:

Enter two numbers

2                                                                               

3                                                                              

Before interchanging a=2 and b=3

After interchanging a=3 and b=2

Write a program to interchange two numbers in c or swapping of two numbers using third variable in c. or Write a c program to swap two numbers.  Write a program to interchange two numbers in c or swapping of two numbers using third variable in c. or Write a c program to swap two numbers. Reviewed by Vision Academy on December 07, 2021 Rating: 5

No comments:

CheckOut

Powered by Blogger.