arrow_upward
Can someone help with my problem?
#1
I have to code a program in C that let me sum up a lot of numbers but just every other value of a bigger number, for example, the number 1234, a just have to sum 1 and 3. My question is, how do I access these numbers, is there an easy way to do it??



#2
Depends you could parse the string or if the numbers are similar use mathematical formulas. Can you provide more info?



#3
Could you use modulo and divide to get the result? Ie to get 1 1234 / 1000 = 1
To get 3 1234 mod 100 = 34 / 10 = 3. There is a pattern with the modulus that would be used in a while loop.