Does number of inputs or outputs affect bitcoin transaction fee?

I would like to know how inputs and outputs affects my bitcoin transaction fee using legacy address, and how using a segwit address will decrease the same transaction?

and how they will be calculated?
if input and outputs affects how can avoid that, apart of segwit address method?

thanks a lot.

Continue reading Does number of inputs or outputs affect bitcoin transaction fee?