w3ajay

tally tutorial point, ms word 2013, ms excel 2013, ms powerpoint 2010,ccc question with answer in hindi 2021, Tally Prime in hindi , tally prime,Python,in python,programming in python,python

Tuesday, December 24, 2019

C Program to Swap Two Numbers

C Program to Swap Two Number



  1. #include<stdio.h>
  2. #include<conio.h>
  3. void main()
  4. {
  5. int first, second, third;
  6. printf("Enter first number: ");
  7. scanf("%d", &first);
  8. printf("Enter second number: ");
  9. scanf("%d", &second);
  10. // Value of first is assigned to third
  11. third = first;
  12. // Value of second is assigned to first
  13. first = second;
  14. // Value of third(initial value of first) is assigned to second
  15. second = third;
  16. printf("\nAfter swapping, first Number = %d\n", first);
  17. printf("After swapping, second Number = %d", second);
  18. getch();
  19. }

No comments:

Post a Comment

for more information please share like comment and subscribe