Question:
How a pipe and a flange are welded in case of male
and female?
Answer:
We can't know for certain what you mean when you say,
"How a pipe and a flange are welded in case of male and female?"
API flanges made to join by welding have only
conventional butt-weld necks. You can see information about joining API
flanges to pipe at
http://www.woodcousa.com/about_wnf.htm and
http://www.woodcousa.com/wnf_flg_atch.htm.
If you mean the joining of plain end pipe to either a
socket weld or a slip on flange, ANSI or ASME flanges may have socket-weld or slip-on
configurations.

Generally a socket-weld flange has a short neck with
a bore large enough to slip over the end of the pipe. The pipe butts
against a shoulder left in the flange bore, an inch or so inside the
face of the flange, and a fillet weld from the flange neck to the pipe
secures and seals the connection. Normally socket-weld flanges have no
weld inside the flange where the pipe fits against the shoulder.

Slip-on flanges usually have a neck and have a
straight bore that the pipe will pass completely through. The installer
will slip the flange onto the pipe end and position the flange so that a
fillet weld on the neck to the pipe, and a fillet weld inside the bore
of the flange between the end of the pipe and the bore of the flange,
will secure and seal the connection.
For more information
about joining flanges to pipe by welding see:
About Weld Neck Flanges.
Weld Neck Flange Attachment.
Q & A 16 Weld
Necks on 6BX Flanges.
Q & A 37 API Flange Weld Neck and
Matching Pipe I.
Q & A 45 API
Flange Weld Neck and Matching Pipe II.