You should never go to work when you have the flu or cold since you could spread your cold or flu virus to your other co workers or you can catch more viruses if those workers have a cold or flu too.
When you're sick you should call in and tell your boss that you're sick and won't be able to come into work because of the flu or cold and then you should stay home at least 2 after the flu or cold virus is gone if possible to avoid infecting anyone else.
When you're sick you won't be as productive anyway since having the flu and cold virus inside you will drain your energy level so you won't get as much done and won't be able to think straight anyway.
So best thing to do is call in sick and stay home until the flu or cold is gone.