Thank Thomas M ,
unfortunately I tried the modified code and it didn’t work
How about this code?
<?php
if ( $post->post_author == '1' ) {
echo 'adsense code for 1';
} elseif ( $post->post_author == '2' ) {
echo 'adsense code for 2';
} else {
echo 'adsense code for 1';
}?>