C Program to print swap number using third variables

 

 

C Program to print swap number using third variables

 #include<stdio.h>

#include <conio.h>

 void main()

{

  int a, b, temp;

  printf("Enter first number: ");

  scanf("%d", &a);

  printf("Enter second number: ");

  scanf("%d", &b);

   temp = a;

    a = b;

   b = temp;

  printf("\nAfter swapping first number = %d\n", a);

 

  printf("After swapping second number = %d", b);

  getch();

} 

Output:

Enter first number: 8

Enter second number: 10

After swapping first number = 10

After swapping second number = 8

 

C

Comments

Popular posts from this blog

C Program to open and write to a text file using fprintf.