MCPcopy Create free account
hub / github.com/Vishruth-S/CompetitiveCode / reverse

Function reverse

Spoj_problems/ADDREV/solution.cpp:11–18  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

9*/
10
11int reverse(int num){
12 int res = 0;
13 while(num){ //Until num != 0
14 res = res*10 + (num%10); //Continue generating reversed number using last digit of original num in each iteration.
15 num = num/10; //Removes last digit of original num.
16 }
17 return res; //Return the obtained reversed number.
18}
19int main()
20{
21 jaadu;

Callers 4

mainFunction · 0.70
mainFunction · 0.50
nextPermutationMethod · 0.50
reorderListMethod · 0.50

Calls

no outgoing calls

Tested by

no test coverage detected