+ 2

Program to Reverse a Number between (1 to 10)

Condition is that You will have to use one variable, one for loop and one if() statement. Answer Please.

2nd Feb 2018, 11:13 AM
Lokesh Kumar
Lokesh Kumar - avatar
2 ответов
+ 16
a number between 1 to 10 //10 not included will look same ... doesn't depend whether reversed or not // & if n==10 , then 01 //thats it , don't even need a loop 👉for no's having more than 1 digit , u can reverse by taking out each places from left side & add it some variable by after multiplying with power of 10 starting from n(digits) to 0 example ::: 1234 //have to reverse it 4*10^4 + 3*10^3 + 2*10^1 + 1*10^0 = 4321 //1 looop require & no if () statement required
2nd Feb 2018, 1:52 PM
Gaurav Agrawal
Gaurav Agrawal - avatar
2nd Feb 2018, 1:47 PM
Muhd Khairul Amirin
Muhd Khairul Amirin - avatar