The Federal National Mortgage Association yesterday announced its second quarterly profit after two years of losses, reporting net income of $22 million (34 cents per share) compared with a loss of $43 million a year ago.

Chairman David O. Maxwell said the second quarter results reflect management's strategy of "balancing the achievement of current profits with long-term improvement in the quality of our earnings and our balance sheet."

Although Fannie Mae is still losing money on its loan portfolio, it has taken several steps to avoid repeating the losses of $190 million in 1981 and $104 million in 1982 caused by high interest rates, Maxwell said.

Maryland National Corp., parent company of Maryland National Bank, reported earnings of $9.7 million ($1.17 per share) during the second quarter, a 4.3 percent increase over the same quarter last year, when the company earned $9.3 million ($1.16) .

For the first six months, however, profits dipped by $100,000 to $19.5 million ($2.37 per share) compared with the first half of 1982. President Alan P. Hoblitzell, Jr. attributed the six months earnings decline to the need to nearly double loan loss reserves to $10.1 million from $5.7 million in mid 1982.

During the second quarter the bank wrote off $6.8 million in bad loans, just over double the amount in same period last year. The charge-offs included a $1 million Mexican loan.

C3 Inc. of Reston said record revenues helped push profits to $2.3 million (27 cents) for the second quarter compared with $2.1 million (25 cents) in the same period a year earlier. Quarterly revenues for the mini and microcomputer firm were up 38 percent to $16.5 million from $12.3 million.

Virginia National Bankshares reported its quarterly net climbed 18 percent to $9.5 million ($1.27) from $8.1 million (1.09) a year ago. First half earnings also hit a new high--$17.8 million ($2.07) compared with $15.3 million ($2.07)

Assets of the Virginia bank climbed 20 percent to $3.8 billion from $3.2 billion and a spokesman said earnings were aided by increases in volume of loans and investments.