23.12.19

swap of numbers program in c

#include<stdio.h>
#include<conio.h>
main()
{
int a,b,c;
clrscr();
printf("\n enter A and B values");
scanf("%d%d",&a,&b);
printf("\n Before Swapping A is %d and B is %d",a,b);
c=a;
a=b;
b=c;
printf("\n After swapping  A is %d and B is %d ",a,b);
getch();
}



OUTPUT:
enter A and B values 34 78
Before Swapping A is 34 and B is 78
After Swapping A is 78 and B is 34

No comments:

Post a Comment

JAVA program pattern 2

import java.util.Scanner; public class pattern3 { public static void main(String args[]) { int i,j; Scanner sc=new Scanner(System.in); Syste...