Category Archives: ACM Technique

Swap without a temp variable

It’s possible with addition:

It’s also possible with multiplication:

 

 

 

Source:
http://www.geeksforgeeks.org/swap-two-numbers-without-using-temporary-variable/

 

Recursion in C

code:

Another code:
it’s not tail recursion

//printing from stack

 

Recursion Example

code:

 

Void clear in C

We  see lots of void in C. Lets clear why we all use  this.

it means  it will return int type value but will not take any parameters..it is also good to define in function prototype

it means it will return int type value but will take parameters that is defined:

it means it will return nothing and if we use return here it will show error as void can’t return a value

but we can return from a condition here is one example:

 

but if we use return value with int return type it will return 1 as true returning.
example could be written as:

Source: Took some help:
http://stackoverflow.com/questions/1043034/what-does-void-mean-in-c-c-and-c
http://stackoverflow.com/questions/416345/is-fvoid-deprecated-in-modern-c-and-c

Extract Digits From a Number and Make a Sum of all the digits and show this in C

Code is here:

Output:

Modular Beautiful Code: 😀

Actually array return function is not directly possible in C and I am finding the solution here.

Took Slightly Help From this link:
https://cboard.cprogramming.com/c-programming/150996-extracting-digits-integer.html

http://mathforum.org/library/drmath/view/56002.html

Find Is It Armstrong Number or Not

code by me:

Logic and Code From the Vids:

Vid:

String Secret Revealed in C

String Input Take Without any gets function just scanf is enough for taking any input withlout gets function

another example:

another: