C++ Program to swap two numbers without third variableWe can swap two numbers without using third variable. There are two common ways to swap two numbers without using third variable:
Program 1: Using * and /Let's see a simple C++ example to swap two numbers without using third variable. Output: Before swap a= 5 b= 10 After swap a= 10 b= 5 Program 2: Using + and -Let's see another example to swap two numbers using + and -. Output: Before swap a= 5 b= 10 After swap a= 10 b= 5
Next TopicMatrix multiplication in C++
|
JavaTpoint offers too many high quality services. Mail us on [email protected], to get more information about given services.
JavaTpoint offers college campus training on Core Java, Advance Java, .Net, Android, Hadoop, PHP, Web Technology and Python. Please mail your requirement at [email protected]
Duration: 1 week to 2 week