Search
Search titles only
By:
Search titles only
By:
Log in
Register
Search
Search titles only
By:
Search titles only
By:
Menu
Install the app
Install
Forums
New posts
All threads
Latest threads
New posts
Trending threads
Trending
Search forums
What's new
New posts
New ads
New profile posts
Latest activity
Free Ads
Latest reviews
Search ads
Members
Current visitors
New profile posts
Search profile posts
Contact us
Latest ads
Google AI PRO - 18 Month
Sanathbh
Updated:
19 minutes ago
Ad icon
Singapore V2Ray VPN for Tunneling
hu KANNA
Updated:
Monday at 9:03 PM
Plan your Crypto & Forex entries before you take the trade
romeshnonis
Updated:
Monday at 3:20 AM
RHCSA, RHCE, AWS, Docker, Kubernetes Training
Sanjeewani95
Updated:
Sep 8, 2026
🛡️ Kaspersky Antivirus – 1 Year / 1 Device | Rs. 2,300 | Only 9 Left
KSPathirana
Updated:
Sep 7, 2026
Electronics
Vehicles
Property
Search
Reply to thread
Forums
General
Education
C/C++ Coding challenges
Get the App
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Message
<blockquote data-quote="Enigma_1" data-source="post: 7979643" data-attributes="member: 78173"><p>This thread is for C/C++ programming. </p><p> I’ll give you guyz an algorithm. Give me a C/C++ implementation of it. Here goes. Say I have a number 896235716. I need to validate this. Validation algorithm is like this.</p><p></p><p></p><p>From the <span style="color: Magenta"><strong>last</strong></span> digit you start extracting. Here the last digit is 6. So you take number 6. Then you don’t take 1 but you take 7. Likewise extraction goes on.</p><p></p><p> <span style="color: Red"><strong>8</strong> </span> 9 <span style="color: Red"><strong>6</strong></span> 2 <strong><span style="color: Red">3</span></strong> 5 <strong><span style="color: Red">7</span></strong> 1 <strong><span style="color: Red">6</span></strong> </p><p></p><p> 8 6 3 7 6 </p><p></p><p></p><p>multiply all the extracted digits by 2 </p><p> <span style="color: SeaGreen"><strong>8X2 = </strong></span>16</p><p><span style="color: SeaGreen"><strong>6X2 = </strong></span>12</p><p><span style="color: SeaGreen"><strong>3X2 = </strong></span>6</p><p><span style="color: SeaGreen"><strong>7X2 = </strong></span>14</p><p><span style="color: SeaGreen"><strong>6x2</strong></span> = 12</p><p></p><p>Then add all the digits together.</p><p> 1+6 + 1+2 + 6 + 1+4 + 1+2 = 24 </p><p></p><p>if the total is divisible by 10 then its a valid number.</p><p> <span style="color: Red">If 24mod10 !=0 then 896235716</span><span style="color: Red"> is not a valid number.</span></p><p>say total is 20. Then 20mod10 ==0 so the corresponding number is valid. </p><p></p><p> Please note that validation number (896235716 in this case) can be varying in length. Extraction always starts from the last digit. If you have doubts on this let me know.</p><p></p><p>mama example valid number ekak dennum.</p><p>5482742451 number eka valid number ekak. </p><p></p><p>kattiya try ekak danna. good luck.</p><p><img src="/styles/default/xenforo/smilies/default/rofl.gif" class="smilie" loading="lazy" alt=":rofl:" title="ROFL :rofl:" data-shortname=":rofl:" /><img src="/styles/default/xenforo/smilies/default/rofl.gif" class="smilie" loading="lazy" alt=":rofl:" title="ROFL :rofl:" data-shortname=":rofl:" /><img src="/styles/default/xenforo/smilies/default/rofl.gif" class="smilie" loading="lazy" alt=":rofl:" title="ROFL :rofl:" data-shortname=":rofl:" /><img src="/styles/default/xenforo/smilies/default/rofl.gif" class="smilie" loading="lazy" alt=":rofl:" title="ROFL :rofl:" data-shortname=":rofl:" /><img src="/styles/default/xenforo/smilies/default/rofl.gif" class="smilie" loading="lazy" alt=":rofl:" title="ROFL :rofl:" data-shortname=":rofl:" /><img src="/styles/default/xenforo/smilies/default/rofl.gif" class="smilie" loading="lazy" alt=":rofl:" title="ROFL :rofl:" data-shortname=":rofl:" /></p></blockquote><p></p>
[QUOTE="Enigma_1, post: 7979643, member: 78173"] This thread is for C/C++ programming. I’ll give you guyz an algorithm. Give me a C/C++ implementation of it. Here goes. Say I have a number 896235716. I need to validate this. Validation algorithm is like this. From the [COLOR=Magenta][B]last[/B][/COLOR] digit you start extracting. Here the last digit is 6. So you take number 6. Then you don’t take 1 but you take 7. Likewise extraction goes on. [COLOR=Red][B]8[/B] [/COLOR] 9 [COLOR=Red][B]6[/B][/COLOR] 2 [B][COLOR=Red]3[/COLOR][/B] 5 [B][COLOR=Red]7[/COLOR][/B] 1 [B][COLOR=Red]6[/COLOR][/B] 8 6 3 7 6 multiply all the extracted digits by 2 [COLOR=SeaGreen][B]8X2 = [/B][/COLOR]16 [COLOR=SeaGreen][B]6X2 = [/B][/COLOR]12 [COLOR=SeaGreen][B]3X2 = [/B][/COLOR]6 [COLOR=SeaGreen][B]7X2 = [/B][/COLOR]14 [COLOR=SeaGreen][B]6x2[/B][/COLOR] = 12 Then add all the digits together. 1+6 + 1+2 + 6 + 1+4 + 1+2 = 24 if the total is divisible by 10 then its a valid number. [COLOR=Red]If 24mod10 !=0 then 896235716[/COLOR][COLOR=Red] is not a valid number.[/COLOR] say total is 20. Then 20mod10 ==0 so the corresponding number is valid. Please note that validation number (896235716 in this case) can be varying in length. Extraction always starts from the last digit. If you have doubts on this let me know. mama example valid number ekak dennum. 5482742451 number eka valid number ekak. kattiya try ekak danna. good luck. :rofl::rofl::rofl::rofl::rofl::rofl: [/QUOTE]
Insert quotes…
Verification
Payakata winadi keeyak tibeda?
Post reply
Top
Bottom