Header Ads Widget

Responsive Advertisement

Ticker

10/recent/ticker-posts

Write a program in c language swapping between numbers using third variable.



/*Write a program in c language swapping between numbers*/
 Or
 /* write a program in c language change between number */ 
Watch Video :- 

Example :-
 Input number
 A= 5 // A is variable
 B = 6 // B is variable
 Output – 
/* Swapping number */
 A = 6
B = 5
understand algorithm
C = a; // C is variable. Value of A variable copy in Value of C Variable
A = B; // Value of A variable copy in Value of B variable.
B = C ; // Value of B Variable copy in Value of C variable
C = A ; // A = 5; than After Copy C = 5;
 A = B; // B = 6; than After copy A = 6,
 B = C ; // C = 5 ; than before copy b = 5;
Output ;-
A = 6 ;
B = 5;

Let start programming 

# include<stdio.h> 
Void main() 

Int a, b, c;
 Printf(“ Enter the value of A and B “); 
Scanf(“%d\n%d”,&a,&b); 
Printf(“ After swapping \n”); 
/* swapping */ 
c = a; 
a = b; 
b = c; 
printf(“a = %d \n b = %d “, a, b); 
}

Download Note Swapping Two Number Click Here 

Post a Comment

0 Comments