Sunday, May 5, 2013

Pro 3-Write a program to exchange the contents of two integers in C++

ALGIRITHM

1  : Integer a, b , temp

2  : Read a, b

3  : Temp<---a

4  : a<--b

5  : b<--temp

6  : Print a,b

7  : Stop

=========================================================================

#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
int a,b,temp;
cout<<"\n Enter the values ";
cin>>a>>b;
temp=a;
a=b;
b=temp;
cout<<"\n The Exchanged values are''<<a<<'' ''<<b;
getch();
}


OUTPUT

   Enter the values 343
   678

   The exchanged values are 678 343

   Enter the values 56 12

   The exchanged values are 12 56

1 comment:

  1. Casino Games - DrmCD
    Casino Games A unique and rewarding 전라북도 출장샵 casino game, 시흥 출장마사지 you 경주 출장안마 will enjoy slots and other 광명 출장안마 table games 울산광역 출장마사지 all without a need to download any software. There  Rating: 2.8 · ‎3,080 reviews

    ReplyDelete