C PROGRAM TO SWAP TWO NUMBERS WITHOUT USING THIRD VARIABLE

Опубликовано: 01 Ноябрь 2024
на канале: PRINCE OF PROGRAMMING
42
like

#C #CTUTORIAL #SWAP #SWAPPING #INTERCHANGING #CPROGRAMTOSWAP #CPROGRAMTOEXCHANGE #CPROGRAM_TO_SWAP_TWO_NUMBERS #SWAPWITHOUTUSINGTHIRDVARIABLE #CLANGUAGE #CPROGRAM #CPROGRAMMING #youtubechannel #youtube #youtuber #youtubers #subscribe #youtubevideos #sub #youtubevideo #like #instagram #programming #coding #programmer #python #developer #technology #code #coder #computerscience #tech #software #codinglife #linux #softwaredeveloper #programmingmemes #programmers #programminglife #hacking #machinelearning #php #computer #softwareengineer #bhfyp

Welcome to my channel Prince of Programming👨‍🎓

   / @princeofprogramming  

This tutorial will give you a full introduction into the
C PROGRAM TO SWAP TWO NUMBERS WITHOUT USING THIRD VARIABLE

   • C PROGRAM TO SWAP TWO NUMBERS WITHOUT...  

Give this video a thumps up👍

Share & subscribe for more videos😏

Show your support to recover the channel❤

Click the bell icon to get notified for new videos🔔

Feel free to drop your doubts in the comment section📗

TOPIC - C PROGRAM TO SWAP TWO NUMBERS WITHOUT USING THIRD VARIABLE    • C PROGRAM TO SWAP TWO NUMBERS WITHOUT...  

*) Swap two numbers means exchange the values of two variables with each other.

*) The idea is to get a sum in one of the two given numbers. The numbers can then be swapped using the sum and subtraction from the sum.

*) This program needs two integer input variables.
first – input variable 1
second – input variable 2

*) We need a printf( ) statement to ask the user to enter the integer inputs.

*) Then we need a scanf( ) statement to read the input from the keyboard and store them into the variables first and second.

*) Then we need a printf( ) statement to print the values of first and second before swapping.

*) We need to swap the two input numbers using arithmetic operations.
first=first+second;
second=first-second;
first=first-second;

*) Then we need a printf( ) statement to print the values of first and second after swapping.