[Let Us C Solutions ] C Program For Swapping two given Numbers
Code : -
#include<stdio.h>
#include<windows.h>
#include<conio.h>
void main(){
int C,D,temp;
system("cls");
printf("\n\n\t\tSWAPPING DEMO ");
printf("\n\n\t\tFirst Type Of Swapping Is Shown below :--");
printf("\n\n\t\tSWAPPING DEMO USING 3RD VARIABLE");
printf("\n\n\t\tEnter Value Of C : ");
scanf("%d",&C);
printf("\n\n\t\tEnter Value Of D : ");
scanf("%d",&D);
temp=C;
C=D;
D=temp;
printf("\n\n\t\tValue Of C : %d ",C);
printf("\n\n\t\tValue Of D : %d ",D);
printf("\n\n\t\tSecond Type Of Swapping Is Shown below :--");
printf("\n\n\t\tSWAPPING DEMO USING AIRTHMATIC OPREATIONS");
printf("\n\n\t\tEnter Value Of C : ");
scanf("%d",&C);
printf("\n\n\t\tEnter Value Of D : ");
scanf("%d",&D);
C=C+D;
D=C-D;
C=C-D;
printf("\n\n\t\tValue Of C : %d ",C);
printf("\n\n\t\tValue Of D : %d ",D);
getch();
}
Comments
Post a Comment