d2jsp
Log InRegister
d2jsp Forums > Off-Topic > Computers & IT > Programming & Development > Starting Programming C
Add Reply New Topic New Poll
Member
Posts: 1,703
Joined: Jul 13 2009
Gold: 2,600.00
Aug 31 2014 02:25am
hi,

whats the best way to get into programming by learning by self? Tried some youtube channels...

Also what the meaning of % in this -> if(i%j==0)

Any answer is welcomed, thx.
Member
Posts: 23,862
Joined: Aug 16 2006
Gold: 20.00
Aug 31 2014 04:08am
Yo

As far as self learning, there are a lot of resources out there.

There are several free UNIVERSITY courses you can take online. I believe Harvard's CS50 is one. My brother took that before and it seemed pretty damn good to me.

Do you need to learn C for any particular reason? A project or job? If not, don't limit yourself to C. If you are brand new to programming, your best bet is to learn good "programming practices" from the ground up. As (some) will tell you, your language choice is irrelevant for learning purposes (but...MAYBE stay away from assembler for a bit. At least until you encounter pointers and know some data structures!)

As far as your final question, a single % in that conditional statement refers to the modulus operator -> http://en.wikipedia.org/wiki/Modulo_operation
Member
Posts: 62,215
Joined: Jun 3 2007
Gold: 9,039.20
Aug 31 2014 04:10am
% is the modulo operator, usually for integer remainder in most languages. The remainder after division may be easier to think about.

https://en.wikipedia.org/wiki/Modulo_operation

Code
Python 3.4.1 |Anaconda 2.0.1 (64-bit)| (default, Jun 11 2014, 17:27:11) [MSC v.1
600 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> 2 % 2
0
>>> 2 % 1
0
>>> 5 % 2
1
>>> 10 % 5
0
>>> 10 % 3
1
>>> 11 % 3
2
>>> def remain_zero(i, j):
... if i % j == 0:
... print('0')
... else:
... print('Nope, heh')
...
>>> remain_zero(10, 5)
0
>>> remain_zero(5, 2)
Nope, heh

Go Back To Programming & Development Topic List
Add Reply New Topic New Poll