Tag Archives: modulo

DCP-4: Great!!! The Work Is Done Solution

code i tried  around 5 of hours but didn’t succeded:


after checking one solution in github repo found the logic and impelmented in my own:

uDebug also helped me for critical case:

Modulo in Details

We can easuly get a range of output value after mod:
Code: for 100 here print from 0 to 99 range

Another Code: here for 1000 it will print 0 to 999 range


Learn Modulo in Easy Way

One thing was confusion for me but after watching this tut it is clear to me now.

if n>a then the result of the modulo result is a, that means a%n=a when a<n

if a<b then a%b is always a

Find sum of digits of a given number in C


With While Loop

With for loop:
Check below I didn’t initialized the for loop,

For Loop Another:


with do while loop